arielplaski Posted June 13, 2018 Share Posted June 13, 2018 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 More sharing options...
peter.w Posted June 14, 2018 Share Posted June 14, 2018 HiNot 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 thestart 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 currencyeg: <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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now