Hello,
Is it possible to insert dynamic date parameters for schedule reports? Like last month? Current month?
Can someone help me with that..
3 Answers:
Posted on February 7, 2013 at 11:02am
There is a section about relative dates in the iReport Ultimate Guide, at http://community.jaspersoft.com/system/files/documentation/ireport-ultimate-guide.pdf.
The guide gives an example:
<parameter class="“net.sf.jasperreports.engine.rd.DateRange”" name="“myParameter”"> <defaultvalueexpression> <!--[CDATA[ new DateRangeBuilder("DAY-1").toDateRange() ]]--> </defaultvalueexpression> </parameter> <querystring> <!--[CDATA[ Select * from account where $X{EQUAL, OpportunityCloseDate, SelectedDateRange} ]]--> </querystring>
The important part is DAY-1. Available keyword are DAY, WEEK, MONTH, QUARTER, SEMI, and YEAR.
Yes I read about it. But when I try it, I always get an error:
Cannot resolve DateRange......
Yes thats because you need to include the class, instead of new DateRangeBuilder("DAY-1").toDateRange()
use new net.sf.jasperreports.types.date.DateRangeBuilder("DAY-1").toDateRange()and have the parameter class as net.sf.jasperreports.types.date.
I had the same story : Doc reading, same example and same error
@zctcurbish : I also tried your solution without any results..