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 Month and Year for Report Params
stinky
I am able to set a default Day report parameter by setting the parameter as NOT REQUIRED and then having the following script within the report design's initialize:
importPackage(Packages.java.util);
importPackage(java.io);
importPackage(java.lang);
globalToday = new Date();
if (params["Day"].value == null)
params["Day"].value = globalToday;
Now, I need and trying to use a similar script to set the default parameters for month and year, which is not working. I get a very cryptic runtime error from the iServer with the following script...
importPackage(Packages.java.util);
importPackage(java.io);
importPackage(java.lang);
importPackage(java.text.DateFormat);
importPackage(java.util.Date);
globalToday = new Date();
sdfmonth = new SimpleDateFormat("MM");
MyMonth = sdfmonth.format(globalToday);
sdfyear = new SimpleDateFormat("yyyy");
MyYear = sdfyear.format(globalToday);
if (params["Month"].value == null)
params["Month"].value = MyMonth;
if (params["Year"].value == null)
params["Year"].value = MyYear;
The Month and Year params are integer values.
The problem appears to be the script to query out the values with the SimpleDateFormat.
Can anyone provide assistance to resolve this problem in any of the following ways:
1. See the particular error with the script?
2. Provide link to some helpful Rhino Java scripting documentation covering SimpleDateFormat?
(Documentation with working examples would be stellar)
3. Any debugging tips, suggestions using the Rhino Java Scripting?
I have asked Actuate and there is not a stand-alone Rhino Java scripting test environment available.
Lastly, here is the cryptic error from the iServer into the resulting status.
Results: Job execution failed.
Status:
Report generation failed. Cause: Unhandled exception when executing script.com.actuate.reportapi.enginemanager.JREMException: Report generation failed. Cause: Unhandled exception when executing script.
at com.actuate.reportapi.engine.birt.BirtUtil.checkTaskError(Unknown Source)
at com.actuate.reportapi.engine.birt.ReportGenerationTask.generateReport(Unknown Source)
at com.actuate.reportapi.engine.ReportGenerationTaskBase.doTask(Unknown Source)
at com.actuate.reportapi.engine.Task.execute(Unknown Source)
at com.actuate.reportapi.enginemanager.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)Unhandled exception when executing script.
Find more posts tagged with
Comments
stinky
I resolved the issue, which was a problem with the packages and not the format statements.
Needed to import...
importPackage(Packages.java.text);
Instead of...
importPackage(java.text.DateFormat);
importPackage(java.util.Date);
This resolves THIS particular problem, but if anyone can still provide assistance on overall helpful Rhino documentation or a better test environment/tips for the javascript environment it would be appreciated.