Jump to content
Changes to the Jaspersoft community edition download ×

percentage formula in an expression


2006 IR Open Dicussion

Recommended Posts

By: Lanurd - llittle

percentage formula in an expression

2006-02-22 15:05

I'm getting compile errors on a variable expression of (($F{IBRSDY} * -100) / $F{CTA$})

 

')' expected value = (java.lang.Double)(((((java.lang.Double)field_IBRSDY.getValue()) * -100) / $F{CTA$} (the ^ is under the { )

 

This is translated from an iSeries formula((T01.IBRSDY * -100) / T03.CTA$) but I'm sure it's not that easy.

 

I tried both Java and Groovy settings.

 

I'm using iReport1.1.0 and a DB2 iSeries database.

 

However, If I exchange the $F{CTA$} for 5000 the compile succeeds, the report runs and the output percentage is correct for the value 5000.

 

Any help would be greatly appreciated.

 

 

 

 

By: Lanurd - llittle

RE: percentage formula in an expression

2006-02-23 20:27

nevermind, the bulb finally lit up.

 

$F{IBRSDY} * -100 / (java.lang.Double)field_CTA$.getValue()

 

 

 

 

By: Giulio Toffoli - gt78

RE: percentage formula in an expression

2006-02-24 22:42

You will be able calc percentages from the next version of ireport (using JR 1.2)

 

The expression to calc a percentage looks like that:

 

new Double( $F{PART}.doubleValue() / $V{TOT_OF_PART}.doubleValue() )

 

where $F{PART} is a field and $V{TOT_OF_PART} is a variable that sums $F{PART}.

 

You need to use "Auto" as evaluation time for the textfield.

 

Giulio

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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