Home
Analytics
Setting parameters in initialize function(?)
DButtery
Ok - why doesn't this work?
In the 'initialize' function of my report design I have the following code:
importPackage(Packages.java.util);
reportContext.setParameterValue("Param1",new String("Default Value 1"));
reportContext.setParameterValue("Param2",new String("Default Value 2"));
I was under the assumption that this code would set my report parameters...
When I run the report, I receive the following error...
+ org.eclipse.birt.report.service.api.ReportServiceException: Required parameter Param1 is not set.
(FYI - I have __parameterpage=false in the URL, otherwise the parameter entry dialog appears...)
What needs to be done to allow me to set the report params in the initialize function and not be prompted for the parameters (or invoke an error).
Thanks,
-Dennis
Find more posts tagged with
Comments
mwilliams
Hi Dennis,
What version of BIRT are you using?
DButtery
I'm using 2.3.1 ...
mwilliams
Dennis,
Does it work for you in the designer, just not in the deployed viewer?
DButtery
Nope. Doesn't work in designer either ...
If I open my report in the designer and select the 'Preview' tab I still get the parameters dialog ...
mwilliams
Dennis,
I tried this in a simple example with BIRT 2.3.1. I created a report parameter that was set to hidden and I unchecked the "required" checkbox, bound it to my dataSet parameter, and set the value in the initialize script. It worked as expected without the parameter box popping up. You may check and make sure you de-selected the "is required" checkbox on your parameter.
DButtery
Success!!
Funny thing was - If I entered garbage into the parameters dialog when it popped-up, my real parameter values were used in the report. So I knew that they were getting through somehow. I just missed the isRequired/hidden piece to get the dialog to stop showing...
Thanks for the extra set of eyes on this one!!
-Dennis
mwilliams
Dennis,
No problem! Glad I could help.
Dale
This concept works for me only when I use that data set in a table - when I try use the data set in a dynamic parameter list it does not work. I checked the execution order in the page <a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php'>Report
Scripting</a> and this theoretically should work.<br />
<br />
I'm using BIRT 2.3.0 and it does not work in the Designer nor the Viewer.
mwilliams
Hi Dale,
So, you're wanting to set a parameter value to limit a dataSet that you're pulling values from for a dynamic list parameter? Is this correct?
mwilliams
Dale,<br />
<br />
I set up something like above. I think I see exactly what you're talking about. Based on the execution order from the link you posted, I would think that this would work as well. I also tried this in the latest version, 2.5.0, with the same result. I guess the only thing I can suggest is to log this as a bug and see what they come back with. You can do this at <a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/reportabug.php'>BIRT
: Reporting Bugs and Requesting Enhancements</a>.
Dale
I forgot to post something back here when I first saw your reply - thanks for the investigation. I'll log a bug and see what happens - luckily this is not a pressing issue for me right now.
SailRCG
If you are setting a condition on a Dynamic Parameters selection list, I'm not sure why you wouldn't just use a filter expression in the dynamic parameters data set?