Schedule reports - Date parameters

Hello,

Is it possible to insert dynamic date parameters for schedule reports? Like last month? Current month?

Can someone help me with that..

samhast's picture
595
Joined: Nov 4 2011 - 6:41am
Last seen: 6 years 6 months ago

3 Answers:

I think that's the solution i am searching for:

iReport 5.0 introduces relative dates..

 

Can someone give me an example how I can do it in iReport..

samhast's picture
595
Joined: Nov 4 2011 - 6:41am
Last seen: 6 years 6 months ago

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.

elizam's picture
14318
Joined: Mar 5 2012 - 9:19am
Last seen: 2 years 10 months ago

Yes I read about it. But when I try it, I always get an error:
Cannot resolve DateRange......

samhast - 10 years 3 months ago

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.

curbish - 9 years 11 months ago

I had the same story : Doc reading, same example and same error
@zctcurbish : I also tried your solution without any results..

fabrice.sabot - 9 years 3 months ago
Hi,
 
I have tried it, but I get this error (by iReport and the Server):
 
"net.sf.jasperreports.engine.rd.DateRange cannot be resolved to a type"
 
Is something missing?
 
Solved:
I use "net.sf.jasperreports.types.date.DateRange" now.
ernst_2's picture
432
Joined: Feb 17 2015 - 1:15am
Last seen: 7 years 5 months ago
Feedback