mikemoer Posted July 20, 2009 Share Posted July 20, 2009 Hi,I've just started using JasperServer and ran in a bit of a snag. Although there is an easy workaround, I had hoped for something more elegant.I have defined a date parameter, which is the date for which I want to run the report, with an input control. I have assigned "new java.util.Date()" as the default value for the parameter. This works great for ad-hoc reporting when the user is prompted for the date (note that the user may select to run the report for a previous date). However for day to day operations I want to schedule the report and get it with today's date (meaning the default value for the date parameter), this does not seem to be workable, and the workaround would be to create another report with a date without input control.I was hoping that by NOT specifying (leaving the input control blank), the date in the schedule it would automatically revert to the default, but that does not seem to be the case. Is there some special value I need to fill into the date input control when specifying the parameter for the schedule, so that the default value will be forced, or is there some other property I need to specify? Thank you for your help,Mike Link to comment Share on other sites More sharing options...
mikemoer Posted August 6, 2009 Author Share Posted August 6, 2009 I found another workaround for this, I created another date parameter based on the first one, which I have defined as shown in the code snippet.This is good for me, as it serves 2 purposes: it solves my default value problem, and it allows me to format the date the way I need to for the purposes of my report.Hope this will help other people as well.Code:$P{REPORT_DATE}==null?new java.text.SimpleDateFormat("yyyyMMdd").format(new java.util.Date()):new java.text.SimpleDateFormat("yyyyMMdd").format($P{REPORT_DATE})Post Edited by mikemoer at 08/06/2009 12:45 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now