Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
get default values of Report parameters programmatically fails
system_migrated
<p>Hi there,</p>
<p>I'm pretty new to BIRT and absolutely new to this community. First of all, thank you all for the hard work needed to create such a great platform and for the support thru this community – I really appreciate your efforts.</p>
<p> </p>
<p>So, that said here is my problem. I’m currently using the BIRT designer via eclipse and have created multiple data sources, data sets, a library and a few reports based on the library. Except for some quirks i had while creating the reports (mostly because I’m new to all the BIRT stuff) everything works as expected. The next step I wanted to do, is using the designed reports from a separate, custom Java program via the BIRT report engine API. The Problem arises if I try to get the default values of a report parameter that originally comes from my library. With a minimum example I verified that the general actions that are performed via the java code are working well, and I can retrieve the default value of a parameter that was created directly in the report. I’m using the following method (i tied multiple variants but all lead to the same result):</p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">IGetParameterDefinitionTask </span></span></span><span style="color:#6a3e3e;"><span style="font-family:consolas;"><span style="font-size:10pt;">paramTask</span></span></span><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;"> = </span></span></span><span style="color:#6a3e3e;"><span style="font-family:consolas;"><span style="font-size:10pt;">engine</span></span></span><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">.createGetParameterDefinitionTask(</span></span></span><span style="color:#6a3e3e;"><span style="font-family:consolas;"><span style="font-size:10pt;">design</span></span></span><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">);</span></span></span></p>
<p> </p>
<p><strong><span style="color:#7f0055;"><span style="font-family:consolas;"><span style="font-size:10pt;">for</span></span></span></strong><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">(Object </span></span></span><span style="color:#6a3e3e;"><span style="font-family:consolas;"><span style="font-size:10pt;">o</span></span></span>: <span style="color:#6a3e3e;"><span style="font-family:consolas;"><span style="font-size:10pt;">paramTask</span></span></span><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">.getDefaultValues().values()){</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">System.</span></span></span><strong><em><span style="color:#0000c0;"><span style="font-family:consolas;"><span style="font-size:10pt;">out</span></span></span></em></strong><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">.println(</span></span></span><span style="color:#6a3e3e;"><span style="font-family:consolas;"><span style="font-size:10pt;">o</span></span></span><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">);</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">}</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">This doesn’t work for me if I try it with fresh included parameters from my library. The default value is always returned as null then. If I modify the configuration of the parameter (not actually changing anything) so that it is not a bare reference but saved to the report itself – everything works fine. </span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">Is this the expected behavior? What should I do for not having to “pseudo-modify†all parameters in every report to make it work? Is there some flag to check if the parameter comes from another file (the library) so I can use the original definition <span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">in that case</span></span></span>? Or is it a bug <span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">actually</span></span></span>? (I don’t think so :P)</span></span></span></p>
<p> </p>
<p>I hope someone can help me with that. Thank you!</p>
Find more posts tagged with
Comments
Migrateduser
<p>***SOLVED***</p>
<p>found the reason - as I already thought, it was my fault
</p>
<p>I just needed to specify the path to the resources with EngineConfig.setResourcePath("path/to/report/designs/etc/");</p>
mwilliams
<p>Glad you found the issue. Definitely let us know if you run into issues in the future.
</p>