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)
Default parameter value
davidch
Is it possible to default a parameter to the current date?
Also, is there a way to put a button on a report to bring up the parameter page?
Thanks
Find more posts tagged with
Comments
davidch
Here is the code I used in the beforeOpen() script if anyone is interested.
If the date passed to the report is null, it sets the parameter dynamically.
if (params["RPT_REPORT_DATE"].value == null)
{
var cal = java.util.Calendar.getInstance();
//If less than 12:20 get data from two days ago
//If greater than 12:20 get data from yesterday
if( parseInt(cal.get(java.util.Calendar.HOUR_OF_DAY)) > 12)
{
if( parseInt(cal.get(java.util.Calendar.MINUTE)) > 20)
{
cal.add(java.util.Calendar.DAY_OF_MONTH, -1);
}
else
{
cal.add(java.util.Calendar.DAY_OF_MONTH, -2);
}
}
else
{
cal.add(java.util.Calendar.DAY_OF_MONTH, -2);
}
params["RPT_REPORT_DATE"].value = (cal.get(java.util.Calendar.MONTH) + 1 ) + "/" + cal.get(java.util.Calendar.DAY_OF_MONTH) + "/" + cal.get(java.util.Calendar.YEAR);
}
vmlinux
Thank you for sharing that!
eoverton
Do you know how when the value is prompted for that the value is pre-populated with the current date?