agavus Posted January 8, 2009 Share Posted January 8, 2009 Hi ,I've been working with IReport for two weeks now and I am having trouble creating a parameter input for my second report.The dates are not stored in the database as datesformat but as YYYYMMDD and the field class for this field is Big.Decimal. I am trying to find a way the create a parameter with class java.util.date were the user can enter a start end end date.Is there an expression to convert the dates that are entered in the parameter to the YYYYMMDD values that are recognized by the SQL.I used the text field expression"new SimpleDateFormat("yyyyMMdd").parse($F{DATE_FIELD}.toString())"to display the YYYYMMDD value from the database as an actual date in the report. What I am looking for is the other way around.Or is there maybe a simpeler solution.Thanks for the help. Post Edited by Ronald Migo at 01/08/09 12:04Post Edited by Ronald Migo at 01/08/09 12:04Post Edited by Ronald Migo at 01/09/09 08:59 Link to comment Share on other sites More sharing options...
hingerl Posted January 8, 2009 Share Posted January 8, 2009 hi, $P{parameter1} = java.util.date; USE_AS_A_PROMPT=yes $P{parameter2} = java.lang.Integer; DEFAULT_VALUE_EXPRESSION=new Integer(new SimpleDateFormat("yyyyMMdd").format($P{parameter1})) USE_AS_A_PROMPT=no in your SQL-Statment, you can use $P{parameter2}, maybe $P!{parameter2}Post Edited by hingerl at 01/08/09 12:36 Link to comment Share on other sites More sharing options...
agavus Posted January 8, 2009 Author Share Posted January 8, 2009 Superrrrrrrr.This work greatThanks a million.Just one more question. For another report I want to display the records from the last two weeks. Is it possible to use something like new date()-14 as a default expression?Thanks Post Edited by Ronald Migo at 01/08/09 15:59 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