Jump to content
Changes to the Jaspersoft community edition download ×

Recommended Posts

I am trying to take the average of account premiums, and the account premium is reading as a string value rather than integer. I have tried to convert is by using:

Average($F{"AccountExt_TotalAccountPremium" == null?0:Inteer.valueOf($F{"AccountExt_TotalAccountPremium"}, 'Current')

but this is not working, "Incorrect expression". Help! I feel like this may be a problem for most of the fields I need to use.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic


Not sure if I understand fully what you are trying to do but..

Is there a reason why you cannot create the AccountPremium as an integer at the
start eg:  ?

<variable name="ACCOUNT_PREMIUM" class="java.lang.Integer"/>[/code]

or as an input field

<field name="ACCOUNT_PREMIUM" class="java.lang.Integer"/>[/code]

Personally I use class="java.math.BigDecimal" for currency

<field name="ACCOUNT_PREMIUM" class="java.math.BigDecimal"/>[/code]

Then the average would be calculated something like this.

<variable name="AVE_ACCOUNT_PREMIUM" class="java.lang.Integer" incrementType="Report" calculation="Average">    <variableExpression><![CDATA[$F{ACCOUNT_PREMIUM}]]></variableExpression>    <initialValueExpression><![CDATA[$F{ACCOUNT_PREMIUM}]]></initialValueExpression></variable>[/code]


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