#1 2016-03-22 12:50:21

brainchutney
Member
Registered: 2016-03-22

Need help in adding a specific Date range as default parameter value

I have deployed a jasper report which accepts 2 date/time params (startdate and enddate)

I need to change the default value such that

startdate defaults to midnight of today i.e :00:00 and current date
enddate defaults to current date and time

In other words by default : I need the report to pull data only for today.

Can this be done ? If so..how ?

Thanks.

Offline

#2 2016-03-23 11:21:54

Arno Mittelbach
datenwerke
Registered: 2012-02-14

Re: Need help in adding a specific Date range as default parameter value

Sure. Use a date parameter and the formula mode. ${today.clearTime()} will set it to midnight of today. For getting the current time, you can use either ${today} or specify "use now as default".

Cheers,
Arno

Offline

#3 2016-03-28 06:56:57

brainchutney
Member
Registered: 2016-03-22

Re: Need help in adding a specific Date range as default parameter value

Hi Arno,

Using the formula ${today.clearTime()} and ${today} doesn't result in anything...When i execute the report..the formulas are taken in as text..and nothing happens in the report


2wrd8on.png

Am i doing something wrong ??


Thanks.

Offline

#4 2016-03-28 09:07:26

Arno Mittelbach
datenwerke
Registered: 2012-02-14

Re: Need help in adding a specific Date range as default parameter value

Hi,

you need to use a date parameter, not a text parameter. You can then switch to the formula mode via a right click.

Cheers,
Arno

Offline

#5 2016-03-28 10:46:39

brainchutney
Member
Registered: 2016-03-22

Re: Need help in adding a specific Date range as default parameter value

Hi Arno,

I have used a Date parameter in the executed report screenshot above...

That is how its displayed if I enter the formula in the "formula as default" field as shown below

30mlhmw.png

Thanks

Offline

Board footer

Powered by FluxBB