stephen.calder Posted January 10, 2013 Share Posted January 10, 2013 I have a field of type float in my DB, let's call it X. I want to have two other user defined variables that do seperate math operations on that value show up in the Detail band, and do sums on them at the end of the report. in iReport, my Expression Editor looks like this for the original DB value: $F{X}My first user defined variable is named "test_var" and looks like this: $F{X}.floatValue()*(1.15)I want my third value, named "test_var_calc" to reference test_var like so: $V{test_var}.floatValue()*(1/0.75)This looks like it should work, but while "test_var" does work correctly, "test_var_calc" is always null. Also, any attempt to sum() the values in "test_var" or "test_var_calc" also always return null. Any help is appreciated. Link to comment Share on other sites More sharing options...
KGZ Posted January 10, 2013 Share Posted January 10, 2013 Hi Stephen,When you put your variables in the Detail band, did you try to change "Evaluation time" propterty ?KGZ Link to comment Share on other sites More sharing options...
stephen.calder Posted January 10, 2013 Author Share Posted January 10, 2013 Yes, "test_var" has the Evaluation Time as "Now", and no matter what I put into "test_var_calc" (Now, Band, Report, Auto) the value is still null. Link to comment Share on other sites More sharing options...
KGZ Posted January 10, 2013 Share Posted January 10, 2013 Can you check if "test_var" is before "test_var_calc" in your Report Inspector ? order is important as the second variable use the first one. Link to comment Share on other sites More sharing options...
stephen.calder Posted January 10, 2013 Author Share Posted January 10, 2013 Thanks for the quick response! Just checked, and "test_var" is before (ie, above) "test_var_calc" in the Report Inspector. Link to comment Share on other sites More sharing options...
KGZ Posted January 10, 2013 Share Posted January 10, 2013 /sites/default/files/files/report2.zipHere is a simple example where I used the same variables and it works. Please let me know if it's similar to your report.KGZ Link to comment Share on other sites More sharing options...
stephen.calder Posted January 10, 2013 Author Share Posted January 10, 2013 Thanks for that! It is similar, but I couldn't get mine to work despite looking at your example. As I'm pressed for time I just modified the query to do the calculations in SQL (which while messy, got things working right). I will come back to this and try to get it working how I want, as I'm sure I'll bump into it again later, and if I sort it out I'll bump this thread. Thanks again! 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