Dates.......

0

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  

 

tafty's picture
4
Joined: Apr 15 2015 - 2:40am
Last seen: 1 month 3 weeks ago

3 Answers:

0

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_date

Good luck

sanbez's picture
832
Joined: Jan 11 2011 - 2:06am
Last seen: 3 weeks 5 days ago
-1

You'll need to align Java Date with SQL Date format.

hozawa's picture
54310
Joined: Apr 24 2010 - 4:31pm
Last seen: 6 months 1 day ago
0

Many thanks for your assistance, got it working now.

tafty's picture
4
Joined: Apr 15 2015 - 2:40am
Last seen: 1 month 3 weeks ago
Feedback
randomness