Relative Dates - Parameter MONTH, YEAR


Can I insert a parameter instead of a hardcoded MONTH -1?

I tried with a string parameter:


But that doesn't work..


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

1 Answer:

If you want to use a parameter, just need to define a DateRange Parameter directly, those can accept either dates or Relative Keywords (i.e. YEAR -1) see the attached Jasper Reposirory Export as an example.


Package icon relativedatesexample.zip7.72 KB
marianol's picture
Joined: Sep 13 2011 - 8:04am
Last seen: 4 years 12 months ago

How can I open that example in ireport?

samhast - 10 years 3 months ago

To open it in iReport unzip the file and go to /resources/public/sandbox/Demos/DateDemo_files, and rename the file to DateDemo.jrxml, you will be able to open that report in iReport. I sent you the full jasperserver export because I also created the input controls for that report so it will be better if you import that to your jasperserver and then open the report from iReport connected to your server.

marianol - 10 years 3 months ago

Thanks for your example marianol, it helps me to create dynamic report with date parameters easily which I was trying for last 2 days, Thank you again

vivek.suyampu - 8 years 2 months ago
show 2 more...

Thanks! This helped me too. Just what I was looking for. I wish, on the Jasper Server, it had the option to switch between the Relative Date and Calendar views (as in Ad Hoc reports). I can enter either a date or relative date to the field and either work. But, it's not intuitive to the user that they have both options.

steveo250k - 8 years 2 months ago

thank you very much it solved my problem in a minute!!!

trinquet.christophe - 7 years 6 months ago