Jump to content
We've recently updated our Privacy Statement, available here ×

Date parameter with iReport


laugue

Recommended Posts

I try to use date parameters (type java.util.Date)

with a report.

 

SELECT ...

FROM ...

WHERE date >= $P{Date1}

AND date <= $P{Date2}

 

 

I have set default value for the 2 parameters like this :

new Date(01,01,2001) for Date1

and new Date(31,12,2099) for Date2

 

but it doesn't work when I launch the report in jasper without parameters.

 

Could you help me.

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 2 weeks later...

lauge,

 

Your default values for your date parameters have to be valid Java expressions. Try instantiating a Date object using correct Java syntax, this should work. For example, a default value for an Integer parameter should look like this:

 

new Integer(0)

 

Date's in Java are created somewhat differently. I think this is where your problem lies. Remember that the Date class is instantiated like so:

 

Date d1 = new Date(aNumberInMilliseconds);

 

HTH...

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...