chriswright Posted March 18, 2009 Share Posted March 18, 2009 I am new to JasperReports and iReport ...I'm trying to format a date and have entered the expression:new SimpleDateFormat("dd/MM/yyyy").format($F{timeentry_DateWorked})Under the expression editor, validation errors tab I get:Expression successfully validated. (the text is red however)I have the class set to:java.util.Dateand evaluation time is set to:nowI have been testing whethre it works by using the Build, Execute (with active connection) menu choice. Nothing is displayed. If I change the expression to simply: $F{timeentry_DateWorked} and the class to string it works. Also, it would be nice to see what my problem is by looking at a log file or something to give me more info. Your help is much appreciatedthanks Link to comment Share on other sites More sharing options...
svenn Posted March 18, 2009 Share Posted March 18, 2009 $F{timeentry_DateWorked}) should be a Date object and you field should be set to String. Link to comment Share on other sites More sharing options...
chriswright Posted March 18, 2009 Author Share Posted March 18, 2009 Svenn,I went to mysql and chaned the field format to date from varchar(50) which is how the application was configured. I assume this is what you meant by $F{timeentry_DateWorked} should be a date object.I changed the class to: java.lang.String. It still doesn't work. Wth this config the expression $F{timeentry_DateWorked} now doesn't work either.Is there an error log somewhere to look at? thanksChris Link to comment Share on other sites More sharing options...
svenn Posted March 18, 2009 Share Posted March 18, 2009 Actually I'm saying that the value has to be stored as date format in you data source. Changing the format of the field to a date is not going to change the fact that the underlying data is being stored as a String.So why are you storing dates in a varchar?What is the format of it? Link to comment Share on other sites More sharing options...
chriswright Posted March 19, 2009 Author Share Posted March 19, 2009 Svenn,I did change the underlying format to date in the datasource. As to why the dates are being stored as varchar(50) I don't know. The application is an open-source project that I am customizing for my use. I can change the field to date from varchar(50) but will need to do some exensive checking to make sure this doesn't break anything. So anyway, having changed the format to "date" from varchar(50) in the datasource (which is a mysql database), the problem still exists. Again it seems to me there should be a way to see more about why the jrxml doesn't compile (i.e I can't view with the JRViewer. Is there an error log anywhere? Thanks for your help 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