Work Around to Solve "An error occured while performing the previous request" When Adding Calculated Field/Measure with Integer() Function to Ad Hoc Crosstab
There’s a known issue in JasperReports Server v6.2,v.6.3, where it is impossible to add a custom calculated field/measure
if it uses Integer() function.
For example, a user creates an Ad Hoc view with Crosstab in JasperReports Server with a custom calculated measure
using Integer() function.
Attempt to add the calculated measure to Crosstab failes with 'An error occured while performing the previous request' message.
Logfile contains stacktrace like
ERROR AdhocAjaxController,http-apr-8630-exec-3:954 - ad hoc controller exception: An error occurred while performing the previous request.java.lang.RuntimeException: groovy evaluation failed on string if (args[0].getObjectType().toString() == 'String') { return args[0].value } else { return sqlArgs[0] } and expression Integer(store1.store_postal_code) at com.jaspersoft.commons.semantic.dsimpl.SQLGenerator.generateSQLForFunction(SQLGenerator.java:1266) at com.jaspersoft.commons.semantic.dsimpl.SQLGenerator.function(SQLGenerator.java:1212).......at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source)Caused by: java.lang.NullPointerException at com.jaspersoft.commons.semantic.dsimpl.SQLGenerator.generateSQLForFunction(SQLGenerator.java:1261) ... 161 more[/code]
The same error appears in logfile in case of using the calc measure as a filter, there is no error message in UI though.
We already had a bug report to address this problem. Until an official fix is made available, a user can use the following approach to work around the problem:
use str2int() function instead of Integer()
Although, the function str2int does not present in the list of available functions, it is possible to type it manually and it works as expected.
Case #01444676
Recommended Comments
There are no comments to display.
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