I have startdate and enddate parameters . I should give the default vaules explained below.
Date range should be last half(1/2) month.
1 to 15 when run from 16th onwords
16 to 31 when run from from 1st until the 15th
If today is 2013-10-07 then startdate is : 2013-09-16 enddate is : 2013-09-31
if today is : 2013-10-23 then startdate is : 2013-10-01 enddate is: 2013-10-15
The same logic should applicable in january month as well(i.e, for instance if today is : 2013-01-13 then startdate: 2012-12-16 enddate:2012-12-31)
Many thanks in Advance :)
Attached is a sample report (DatesStandard.JRXML) that will give you some pointers on how to do this. As you said you need to write the expressions to initialize those parameters in Java or Groovy. Check my deafult expressions for my date to / from parameters in the attached sample.
The .ZIP file that I attached is a JasperServer Repository export of the same report so you can add it to your server and see how it works form there the report will be put into /public/sandbox/demos/Standard Dates
Another method you can use is to use is to use the JRS relative dates classes to allow the use of keywords to identify date ranges for this method see the DatesRelativeSample.jrxml attached
|Demo for calculating default date values for parameters||10.41 KB|
|calculated default date values for parameters JRS export||6.45 KB|
|A sample using JasperServer relative dates||7.04 KB|