Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
how to set default date value to a text input parameter
chalshi
requirements:
1. run the report, pop up a parameter window, today's date value will be default in the text input parameter component. (can't use combo box or list box, use text).
2. user can change the date parameter to whatever date they want.
tried the dynamic dataset parameters, but must use list box or combo box, user can not change data they want.
any comments would be very appreciate!
Find more posts tagged with
Comments
Happy
Try this scriptlet I'm using to do just that
var parsedDate = BirtDateTime.now();
var startDate = parsedDate.toString();
var newStartDate = startDate.substr(0, 10) + " 08:00:00";
newStartDate;
Sets the date to Today at 8am
edit: you can use Javascript for text items, by click the down arrow on the little box next to the text window and it will let you input javascript (using the eclipse designer)
chalshi
thanks, but i can't find the place that can input javascript (using the eclipse designer), there are little down arrow besides the text 'default value: '.
but i only can input default value for text parameter.
Happy
When you click the down arrow you should see the following screenshot.
Clicking on "JavaScript Syntax" should give you what you need
chalshi
why my eclipse IDE don't have that? my BIRT is all-in-one 2.2.2.
chalshi
is that BIRT's new feature or just eclipse new fareture?
Happy
might be a new feature of birt 2.3 or birt 2.5.0
someone else would be better to confirm
chalshi
downloaded version 2.3.2 and 2.5.1, just 2.5.1 has the property. but if i want to implement the default date i must convert it to new version. Is there any other ways can make that in old version?
Happy
I'm only speculating here, but you may be able to create it using a report parameter script.
Take the example I gave, goto the script pane and click on the report parameter.
Version 2.5.0 lets me override these methods:
getDefaultValueList
getSelectionValueList
and
validate.
You may be able to override the contents of getDefaultValueList.
I have not tried it though and do not know if the option is even available for 2.3.2
Good luck though
chalshi
thank you very much!