Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
How to set date time parameter for dataset programatically
Migrateduser
<p>Hi,</p><p> I have a SQL based dataset with 2 parameters of type DateTime. I am trying to set the values for the parameters in beforeOpen as follows:</p><pre class="_prettyXprint">....} else if (reportContext.getParameterValue("period").equals("monthly")) {var date = new Date();var startDate = new Date(date.getFullYear(), date.getMonth(), 1);var endDate = new Date(date.getFullYear(), date.getMonth() + 1, 0);this.setInputParameterValue("startDate", startDate);this.setInputParameterValue("endDate", endDate);} .. ..</pre><div> </div><div>But when I run the report I get the following error:</div><div>[color=#ff0000;]<span>- [/color]An exception occurred during processing. Please see the following message for details:<br />
Failed to prepare the query execution for the data set: CompletedJobsByRole<br />
<span class='bbc_underline'>Cannot convert the parameter value org.mozilla.javascript.NativeDate@b4fe832 to type class java.sql.Timestamp.<br />
Can not convert the value of org.mozilla.javascript.NativeDate@b4fe832 to Date type. (Element ID:824) exception.error ( 1 time(s) )</span><br />
detail : org.eclipse.birt.report.engine.api.EngineException: An exception occurred during processing. Please see the following message for details:<br />
Failed to prepare the query execution for the data set: CompletedJobsByRole<br />
Cannot convert the parameter value org.mozilla.javascript.NativeDate@b4fe832 to type class java.sql.Timestamp.<br />
Can not convert the value of org.mozilla.javascript.NativeDate@b4fe832 to Date type. (Element ID:824)<br />
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1237)<br />
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1216)</span></div><div> </div><div>I'd appreciate if someone could help. Some sample code would be even better. Thanks</div><div> </div><div>btw, the idea is to get the start and end dates of the current month and pass it to the query.</div><div> </div><div>- J</div>
Find more posts tagged with
Comments
There are no comments yet