String to Integer


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.

arielplaski's picture
Joined: Jun 13 2018 - 11:08am
Last seen: 2 years 1 month ago

1 Answer:



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"/>

or as an input field

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

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

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

Then the average would be calculated something like this.

<variable name="AVE_ACCOUNT_PREMIUM" class="java.lang.Integer" incrementType="Report" calculation="Average">

peter.w's picture
Joined: Oct 12 2012 - 6:57am
Last seen: 4 weeks 1 day ago