tafty Posted June 24, 2015 Posted June 24, 2015 Hi All thanks in advance for any help.I'm trying to construct a report which amongst other things uses a 'from' and 'to' date as part of the select.To do this I have created 2 parameters called 'date_from' & 'date_to' which are of class java.sql.Date and this give the end user a nice little calander icon to select the dates.I also have created 2 parameters called 'from_date' & 'to_date' which are are of class java.lang.String. The default vale expression is set to 'new SimpleDateFormat("dd/mm/yyyy").format($P{date_to}) (or date_from) These parameters are then embeded in the SQL as below... and it.dstamp between to_date ($P{from_date}, 'dd/mm/yyyy') and to_date($P{to_date}, 'dd/mm/yyyy') ...In studio this works sometimes, and sometimes not.... When I display all the parameters to the report header, sometimes the string parameters show a date, and most of the time null.On the reports server, it never works.I have amended the jasper_config.properties file on the server to suit, I have added a suitable patten in the text field of the parameter, and I have repeatedly banged my head on my desk. Any assistance would be gretly appreciated. Many Thanks
sanbez Posted June 24, 2015 Posted June 24, 2015 1. I am don/t understand which reason make string parameters? You can use dates in query.2. Order parameters sometimes is important. Place parameters in tree in order when dependent parameters after parent: date_from, date_to, from_date, to_dateGood luck
hozawa Posted June 24, 2015 Posted June 24, 2015 You'll need to align Java Date with SQL Date format.
tafty Posted June 29, 2015 Author Posted June 29, 2015 Many thanks for your assistance, got it working now.
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