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.

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

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

Am i doing something wrong ??

Thanks.

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

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

Thanks