new net.sf.jasperreports.types.date.DateRangeBuilder("MONTH-1").toDateRange()
Can I insert a parameter instead of a hardcoded MONTH -1?
I tried with a string parameter:
new net.sf.jasperreports.types.date.DateRangeBuilder($P{parameter1}).toDateRange()
But that doesn't work..
1 Answer:
Posted on July 1, 2013 at 7:35am
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.
Attachments:
Attachment | Size |
---|---|
![]() | 7.72 KB |
How can I open that example in ireport?
To open it in iReport unzip the file and go to /resources/public/sandbox/Demos/DateDemo_files, and rename the file DateDemo_jrxml.data 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.
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
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.
thank you very much it solved my problem in a minute!!!