scottward Posted March 16, 2007 Share Posted March 16, 2007 Hello, When I place a text field with the following expression in the main report, everything works fine:"test " + org.apache.commons.lang.time.DateFormatUtils.format($V{StartDate}, "yyyy") When I place the same expression in a textfield in the detail field of a crosstab, I get the following error: Error evaluating expression : Source text : "test " + org.apache.commons.lang.time.DateFormatUtils.format($V{StartDate}, "yyyy") groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method: format. Cannot resolve which method to invoke due to overlapping prototypes between: [long, class java.lang.String] and: [class java.util.Date, class java.lang.String] at groovy.lang.MetaClass.checkForInvalidOverloading(MetaClass.java:1770) The StartDate measure is set as a Date with an expression that references the StartDate parameter, which is a Date. This is interesting: when I replace $V{StartDate} with "new Date()" it works fine! Also, if I type in numbers (to pretend that I want to enter a Long) it compiles. Its like the compiler can't tell if $V{StartDate} is a Date or a Long. But again I've triple checked that indeed it is a Date! What am I missing here? It may be something simple that my non-Java-experiened-eyes can't see. You're input is greatly appreciated. Scotty Link to comment Share on other sites More sharing options...
lucianc Posted March 16, 2007 Share Posted March 16, 2007 This is likely a Groovy 1.0-beta-10 issue. We have recently upgraded to Groovy 1.0 and the error no longer occurs. You can check out the JR source from SVN and test whether the issue is fixed for you as well. Regards,Lucian Link to comment Share on other sites More sharing options...
scottward Posted March 17, 2007 Author Share Posted March 17, 2007 Thanks for the response Lucian. I figured out that the problem had to do with the the fact that whenever the measure was null, so was the variable I was passing to DateFormatUtils. The text field had an expression set to a measure and a hypertextReference that utilized a parameter to construct the link. When the measure was null, the paramater was too for some reason. I just made the expression for the link conditional so it only constructed the link (and referenced DateFormatUtils) if the measure was not null. Scotty 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