Jump to content

iReport textfield value


crinch

Recommended Posts

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 this


number_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

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

 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

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