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)
Dynamically change the default value of a parameter at runtime?
chorton
I'm looking for a way to change the default value of a parameter at runtime.
When I run a report I need the parameter to default to the current year and month (exa. 201004) while also giving me the option to change it before clicking OK on the parameter screen.
I have a script worked out to get the appropriate year and month and apply it as the value when the report is ran. The problem is that I can't get my value to display in the parameter's text box.
With my script running in the 'initialize' method the report works like this when the 'Preview' tab is clicked.
1. User gets prompted for a parameter which is blank
2. User enters a value and clicks ok.
3. The value entered by the user gets over-written with the value created by my script.
I need a way to place my value in the blank text box so that the user can change it if they need to.
I hope that makes sense.
Find more posts tagged with
Comments
mwilliams
Hi chorton,
What version of BIRT are you using? BIRT 2.5 has an option to use javascript for the default value of a parameter. This would be the easiest way to solve your issue.
chorton
We're currently using 2.3 but I can't get it to work in 2.5 either.
In 2.5 I change the option next to default value to 'Javascript Syntax' and enter something as simple as 'BirtDateTime.now()' but can't get it to display anything.
chorton
Scratch that. I opened a report I created in 2.3 in 2.5. I think it was caching my old value.
Created a new report in 2.5 and it works.
Thank you, apparently if we want this functionality we have to upgrade.
Thanks for the input.