Error when trying to use relative dates

0

I copied the first part of code in http://community.jaspersoft.com/wiki/how-use-relative-dates-jrxml-static... to a project using the sample database.

<parameter class="net.sf.jasperreports.types.date.DateRange" name="BeginDate">
    <defaultvalueexpression>
        <![CDATA[NEW net.sf.jasperreports.types.date.DateRangeBuilder("WEEK-14").toDateRange()]]>
    </defaultvalueexpression>
</parameter>
<parameter class="net.sf.jasperreports.types.date.DateRange" name="EndDate">
    <defaultvalueexpression>
        <![CDATA[NEW net.sf.jasperreports.types.date.DateRangeBuilder("WEEK-1").toDateRange()]]>
    </defaultvalueexpression>
</parameter>

When I try moving from the source tab to the design tab I keep getting the following error:

I really don't get what's wrong. Please help.

Jasperiousity's picture
Joined: Nov 10 2015 - 6:32am
Last seen: 1 year 11 months ago

1 Answer:

0

Try this:

<parameter class="net.sf.jasperreports.types.date.DateRange" name="BeginDate">
    <defaultValueExpression>
        <![CDATA[new net.sf.jasperreports.types.DATE.DateRangeBuilder("WEEK-14").toDateRange()]]>
    </defaultValueExpression>
</parameter>
<parameter class="net.sf.jasperreports.types.date.DateRange" name="EndDate">
    <defaultValueExpression>
        <![CDATA[new net.sf.jasperreports.types.DATE.DateRangeBuilder("WEEK-1").toDateRange()]]>
    </defaultValueExpression>
</parameter>
zh3ntil's picture
531
Joined: Nov 19 2014 - 11:02pm
Last seen: 3 years 3 months ago
Feedback
randomness