2005 IR Help Posted August 23, 2006 Share Posted August 23, 2006 By: Pablo Paggi - larvamdp Change the returned value from a text field 2004-03-04 11:25 Hi !!! The text field contains a date, but isn't a java.util.Date (can't use the pattern property), and I have to change the format in the report. Example: 2001-16-01 to 16-01-2001. I can convert the type of text field to java.lang.String type. To do this, I defined the type as Object <field name="date" class="java.lang.Object"/> and use the method $F{date}.toString() Can I insert Java code (more than one sentence) into the xml report file to change the string format? and Can I use a method from an utility class made by me to solve the problem? If this is possible, please give me an example. Tks !!!! Pablo. By: Chuck Deal - cdeal RE: Change the returned value from a text field 2004-03-04 12:44 To use your own utility class, simply use it's fully qualified name (my.utility.class.Utilities.convertDate()). Make sure that the class is in the classpath that JasperReports will be using. If you think you are going to need some more complex Java, use a Scriptlet (see samples). Scriptlets are relatively easy to use and can move complex Java statements out of the report design making the XML easier to use. By: Pablo Paggi - larvamdp RE: Change the returned value from a text field 2004-03-05 10:10 Both solutions works fine !!! I'm using the first one for the this particular case, but in a few days, I'll use a scriplet due to the complexity of the next report. Thanks Chuck !!! Pablo. 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