mary_k Posted July 29, 2010 Share Posted July 29, 2010 Hi,i would like to use a user defined function in jrxml but it is not working. it is the part in the jrxml:<textFieldExpression class="java.sql.Timestamp"><![CDATA[getPersianDate($F{DAT_CREATION})]]></textFieldExpression>Then in the application that filling is done i have added a method called getPersianDate(Timestamp dat_creation)But i get the following error:Caused by: groovy.lang.MissingMethodException: No signature of method: TableReport_1280387733008_408819.getPersianDate() is applicable for argument types: (java.sql.Timestamp) values: {2010-01-05 12:20:18.857}could somebody please help me? how can i get rid of this error?Thanks in advance.Best Regards,Mary Link to comment Share on other sites More sharing options...
lucianc Posted July 30, 2010 Share Posted July 30, 2010 You can't directly call a method from the class that performs the report fill. What you need to do is to make the method static and call it using the class name, i.e. something like MyClass.getPersianDate(..)HTH,Lucian Link to comment Share on other sites More sharing options...
mary_k Posted August 1, 2010 Author Share Posted August 1, 2010 Hi,thanks for you solution but it did not work. I get the following error:Caused by: groovy.lang.MissingPropertyException: No such property: TableApp for class: TableReport_1280648128136_469927and Error evaluating expression : Source text : TableApp.getPersianDate($F{DAT_CREATION})I think some how the class TableApp must be defined in jrxml. But do not know how.Could you please help me.Thanks in advance.Best Regards,Mary Link to comment Share on other sites More sharing options...
lucianc Posted August 9, 2010 Share Posted August 9, 2010 Is TableApp on the classpath? And in the root package?Regards,Lucian Link to comment Share on other sites More sharing options...
mary_k Posted August 10, 2010 Author Share Posted August 10, 2010 Hi,thanks for your reply. But it was not the reason. I found the solution, namely the class in which the method is defined, must be imported in the jrxml file:<import value="packagename.classname"/>packagename is the package where the class is placed.It is important to put the import tag after the property tag and before the parameter tag.I hope this will help others.Thanks.Bye,Mary 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