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

iReport Error evaluating expression


marlin_snyder
Go to solution Solved by mgeise,

Recommended Posts

We are using 5.0.1, and have converted many of our Crystal Reports projects over to iReport/Jasperserver and are happy with the results so far.

I am converting a summary report now that has variable fields in the detail section, multiplying a combination of integer fields and float fields from the database.  I am suppressing the detail section using the Print When Expression, and have created 3 variables to sum the total of the 3 associated variables in the detail section.

The business rule is to round the result in the summary, so, in the Variable Expression of the 3 summing variables in the group footer, I am wrapping Math.round() around the variable name from the detail section in all 3 of the summary variable properties.  Two of them work flawlessly, one does not.  We have double and triple checked to make sure that the summary variables have exactly the same properties, even copying from the working one(s) to the non-working and then renaming.  We have checked the Variable Class to make sure it is Float datatype, and we have checked the data to make sure there are no NULL, empty string, or character data where there should not be.  I have also run the report using the Empty Datasource, and it compiles and runs, but obviously with no results.

If I remove the Math.round() wrapper, the report will compile and run with the other two summary variables rounding fine, but as soon as I add the wrapper function to the 3rd variable, the report throws an error: Error evaluating expression...then flags Math.round(LCIncr_Total), which is the offending variable name.  I will attach the .jrxml and .jasper files to this request.

Any assistance is appreciated greatly...

M. Snyder

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Solution

The order in which your Variables are defined matters.  Since the LCIncr_Total actually uses LC_Increase, LC_Increase needs to appear before LCIncr_Total.  In the report inspector panel, you should be able to just grab the LC_Increase variable and move it up higher in the list (before LCIncr_Total, but after LCUpPrice since LCUpPrice is used to define LC_Increase).

Try that and see if it solves things for you.

Link to comment
Share on other sites

Excellent! Thanks much for the pointer, that worked perfectly. I did find a 'workaround' by clicking directly on the field in the report, I was able to apply the rounding function at that level (certainly after the variable has been evaluated, so going around the issue I was having), and it worked. I have now removed that field level formatting and applied it to the variable after moving the dependent variable up in the list.

 

Thank you again,

 

M. Snyder

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