Reputation: 94
I have a report designed using Jaspersoft iReport Designer 5.1 with two input parameters defined with a default value expression to define a date range
<parameter name="lowerDate" class="net.sf.jasperreports.types.date.DateRange">
<parameterDescription><![CDATA[Enter Lower date]]><parameterDescription>
<defaultParameterExpression><![CDATA[new net.sf.jasperreports.types.date.DateRangeBuilder("YEAR").toDateRange().getStart()]]></defaultValueExpression>
</parameter>
<parameter name="upperDate" class="net.sf.jasperreports.types.date.DateRange">
<parameterDescription><![CDATA[Enter Upper date]]><parameterDescription>
<defaultParameterExpression><![CDATA[new net.sf.jasperreports.types.date.DateRangeBuilder("DAY").toDateRange().getEnd()]]></defaultValueExpression>
</parameter>
In the report configuration in JRS I have defined the input parameters and bound them to the report parameter names and set them as not mandatory. The report runs just fine and populates the date fields appropriately with the year start date and today's current date without prompting.
My issue is I cannot get the same behaviour when the report is run via a schedule which I have configured to run daily. In the schedule configuration, as I did not make the input parameters as mandatory, are blank - assuming the default values as specified in the report should be used, however the 'upperDate' parameter is not reflecting the current day but retaining the original value from the report first ran. I've tried various combinations in the config but nothing seems to make the report update the date values during a scheduled run.
Any help would be most appreciated.
Upvotes: 0
Views: 922
Reputation: 6663
I have some scheduled reports where I want to use default values such as the current or previous date for certain parameters. The way I do it is leave the parameters blank in the JRS schedule. Then in the report's SQL, I replace null parameters with the default value I would like to use (current date, previous day's date, etc.).
Upvotes: 0