Problem with $P{REPORT_PARAMETERS_MAP}

0

Hello,


I’m facing a problem since I updated my Jasper Library from 3.0.0 to 6.6.0.


I used to use the parameter “REPORT_PARAMETERS_MAP” in order to generate my summary. The main report contained subreport which filled this map and at the end of the generation, the summary used this parameter to create each title linked to its associated page.


Now the problem is the following: The changes made on the parameter “REPORT_PARAMETERS_MAP” cannot be seen in the parent report. For example, if I do “$P{REPORT_PARAMETERS_MAP}.put (“Object1”, “Text”)” in a subreport, I won’t be able to get the value of the “Object1” elsewhere but in this report and its subreport. I use the REPORT_PARAMETERS_MAP as a parametersMapExpression in each call to a subreport.


I read that the way to pass a map to a subreport changed in the 3.0.1 version but I still can’t find how to make it work.


Do you have any ideas?


Thanks.

maximeg13's picture
Joined: May 20 2019 - 6:54am
Last seen: 3 weeks 4 days ago

3 Answers:

1

When I remember rigtht, the default ReportParametersMap is CLONED when it's passed to a SubReport. I think you should create an own "TopLevel parameter" of type HashMap and pass this own map as single SubReportParameter from MasterReport to each SubReport. Not sure if each SubReportParameter was cloned also when it's passed to the called SubReport. But worth to give it a try.

The other idea would just be a simple ScriptletClass that you could use for collecting such things over several report levels.

hth + regards

C-Box

C-Box's picture
1435
Joined: Jul 19 2006 - 5:58pm
Last seen: 33 min 14 sec ago
0

Hello,

Thank you for your answer, I'll try to create my own HashMap and use it like I need.

I'll also try the ScriptletClass if I can't make it work.

Regards

maximeg13's picture
Joined: May 20 2019 - 6:54am
Last seen: 3 weeks 4 days ago
0

Hello,

My problem is solved, I created my own HashMap parameter and it worked like a charm, I didn't even need to pass it as a subreport parameter, just to create it in main and sub reports and instanciate it in main.

Thanks for your help !

Regards

maximeg13's picture
Joined: May 20 2019 - 6:54am
Last seen: 3 weeks 4 days ago
Feedback
randomness