crinch Posted July 26, 2012 Share Posted July 26, 2012 Hi, I am using JasperReport Server 4.5, I am creating a sample report in iReport using a query. I need to display text field value by calculating something like thisnumber_format(($newOrders*100)/$totalOrders, 2)where $newOrders = query field & $totalOrders = variable.I know how to set the value of a field by right clicking on the field and select 'Edit Expression' and then we select query fields, variable etc.But I am not getting understand how I can set the value of field by making calculation of other query fields and variables. I am very much thankful for help. Link to comment Share on other sites More sharing options...
mrcaffeine Posted July 27, 2012 Share Posted July 27, 2012 This can be easily achieved.I assume you have a field $F{newOrders} and a variable $V{totalOrders} (as sum over $F{newOrders})create a text field where you add as expression ($F{newOrders}*100)/$V{totalOrders}. Configure this text field to evaluation time : auto (jasperreports determines when to calculate the field) pattern : #,##0.00 result: the correct value is displayed during report run time. 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