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)
Optional parameters
avujic
<p>Hello everyone,</p><p> </p><p>I have a report that has several parameters. Two of them has to be optional. Those two parameters are Date types (from date and to date). </p><p> </p><p>When I exclude date parameters (null value is set), report crashes. I heard I can edit beforeOpen script, but I don't know where it is.</p><p> </p><p>Can someone tell me how to edit beforeOpen script in the way report does not crash when I exclude those two parameters?</p><p> </p><p> </p><p>Thank you and regards,</p><p>Aleksandar</p><p> </p><p> </p>
Find more posts tagged with
Comments
bgbaird
<p>Hi Aleksandar, The way I do this:
Dataset SQL
SELECT stuff......
FROM tables.....
WHERE stuff.....
Then in the before open method of the dataset:
if(parameter[date1].value!=null&¶meter[date2].value!=null)
{
this.queryText = this.queryText + " AND table.date between '"+parameter[date1].value+"' and '"+parameter[date2].value+' ";
}
Brian</p>
avujic
<p>Hi Brian,</p><p> </p><p>Still I dont know how to edit my beforeOpen script.</p><p> </p><p>Can you tell me step by step to do this (for example: 'MyDataSet' => right click => edit.......)</p><p> </p><p> </p><p>Aleksandar</p>
bgbaird
<p>Aleksandar, when you have the dataset highlighted, select the script tab in the editor window, and select beforeOpen. </p><p>I googled "birt how to beforeopen script", and found a step-by-step:</p><p> </p><p><a data-ipb='nomediaparse' href='
http://aimbirt.blogspot.com/2010/06/multiple-multi-select-parameters.html'>http://aimbirt.blogspot.com/2010/06/multiple-multi-select-parameters.html</a></p><p> </p><p>I
HIGHLY recommend that you take advantage of the BIRT Report Developer Guide help content in the Eclipse HELP component. It is congruent to the BIRT Field Guide, I still refer to it routinely.</p><p> </p><p> </p><p>Brian</p>
avujic
<p>Brian,</p><p> </p><p>Thank you for your suggestions about Birt Report Developer Guide. </p><p> </p><p>Unfortunately, even with your IF statement, I get null pointer exception for date parameters when I try to exclude them.</p><p> </p><p>I tried to put '==null' in IF statement just to test it, but still null pointer exception occurs.</p>
avujic
<p>Brian, not sure what I did, but I managed to get rid of null pointer exception. </p><p> </p><p>Thank you for your help. </p>