Jump to content

how to subtract two values read from table?


jyoti.doddagoudar

Recommended Posts

I'm printing a report in which i need to fetch previous and current value from the same 

 

colomn of the table and subtract those values and print it.

 

1.I m not getting how to fetch previous and current value from the same colomn

 

2.how to store fetched values using variables and to perform subtraction on them.

 

Info:Data type of colomn field used in table is Integer

 

Please Help me

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Just create 2 variables. Example, V${CURRENT_VALUE} and V${OLD_VALUE}. Set V${CURRENT_VALUE} to F${your_field} and V${OLD_VALUE} to V${CURRENT_VALUE}. The trick is to order V${OLD_VALUE} before theV${CURRENT_VALUE} in the Outline view.

JasperReports evaluates variable expression in the order they appear in the Outline View so V${OLD_VALUE} is evaluated before V${CURRENT_VALUE} is updated with the current field value.

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