Jump to content

Crosstab: divide two measures


gundinge

Recommended Posts

Hi all,
I have a probelm: I want to divide two measures in a crosstab and become an "error evaluating expression" error.
I have defined my measures as followed:
MS_TURNOVER_EUR_Measure (class: java.math.BigDecimal, value: $F{MS_TU_EUR})
MS_TURNOVER_AVG (class: java.math.BigDecimal, value: $F{MS_TU_AVG})
 

the new text field expression is following: (class: java.math.BigDecimal)
($V{MS_TURNOVER_AVG}.compareTo( new java.math.BigDecimal(0.00))== 0 ? $V{MS_TURNOVER_EURMeasure} : $V{MS_TURNOVER_EURMeasure}.divide( $V{MS_TURNOVER_AVG} ))

does somebody know where the failure is?

many thanks in advanced!

here you will find a part of my jrxml:

 

Code:



Post Edited by gundinge at 07/13/2010 12:08
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,
I already found a solution how it works...
I did a typecast from "bigdecimal" to  "float" and I used function "msg" and then it will work:

($V{MS_TURNOVER_AVG}.compareTo( new java.math.BigDecimal(0.00))== 0 ? "0" : msg("{0,number,##0.0 %}", new Float($V{MS_TURNOVER_EURMeasure}.floatValue() / $V{MS_TURNOVER_AVG}.floatValue())))

best regards

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