Schedule reports - Date parameters

0

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
92
Joined: Nov 4 2011 - 6:41am
Last seen: 2 years 5 months ago

3 Answers:

0

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
92
Joined: Nov 4 2011 - 6:41am
Last seen: 2 years 5 months ago
0

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
3683
Joined: Mar 5 2012 - 9:19am
Last seen: 1 month 2 days ago

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

samhast - 6 years 2 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 - 5 years 10 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 - 5 years 2 months ago
0
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
154
Joined: Feb 17 2015 - 1:15am
Last seen: 3 years 4 months ago
Feedback
randomness