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

Date formats and Validation


chriswright

Recommended Posts

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.Date

and evaluation time is set to:

now

I 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 appreciated

thanks

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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?

 

thanks

Chris

Link to comment
Share on other sites

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

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

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...