Home
Analytics
How to pass a Java Map as parameter from Java Code to the report.
Tuco
Hello Birt world,
Here's my scenario with BIRT.
1) .rptdesign template files will be stored in the database.
2) A REST url of the form "/reportDesign/{Id}/report?someParamsAndSomeValues" will be passed.
3) depending on someParamsAndSomeValues, in the Java code, a HashMap can be created of all the parameter and their values which the report will need.
4) A few of the parameters above will be required by the report and they will be in the .rptdesign file.
Ex.
1) Let's say the rptdesign file is stored in the database or the file system and it requires FirstName and LastName of a person.
2) A REST URI of form "/reportDesign/{reportDesignId}/report?PersonId=1" will be passed.
3) In the java code, a HashMap with all the properties of Person can be populated like
person.FirstName = Tuco
person.LastName = ABC
person.address = DEF
4) In the .rptdesign file, in the fetch script for scripted datasource, we can write
dataSetRow["FirstName"] = map.get("person.FirstName");
Only problem is how do i pass this populated map from the Java code to "open" script of the datasource or the dataset.
can it be passed in the Task or through the context in the Report Engine? How do i get access to it in the "open" or the "fetch" portion of the script?
Please let me know in case the question is unclear. I can post some code if required.
Thanks a lot.
Find more posts tagged with
Comments
There are no comments yet