title: iReport Error evaluating expression
body: <p>We're using iReport 5.0.1, and have successfully converted many of our Crystal Reports packages over.</p>
  
  <p>I'm working with data that is a mixture of integer and double data type, and I am performing calculations inside the variable fields in the detail section.</p>
  
  <p>I then have 3 variables that are summing the detail data.  The first variable is a straight sum of the detail variable above it.  The second one adds either one Parameter, or a second Parameter, depending on an IF..THEN..ELSE statement, and the third subtracts the very same Parameter values based on a similar IF..THEN..ELSE statement.</p>
  
  <p>I need to round the 3 variable fields in the Group Footer, so I apply Math.round(variable_name) to each of the 3 variables.  The original one, and the last one (subtracting the Parameters) both work perfectly.  The middle variable (adding the Parameters) throws an error, "Error evaluating expression: Math.round(variable_name)".  If I take out the formatting, it runs fine.</p>
  
  <p>I have copied and pasted the working variables, renaming it to the correct name, to make sure that I'm not missing something in the way I set them up originally, to no avail.  When I run it using Empty Datasource, it runs, but of course with no data.</p>
  
  <p>This would lead me to believe that there is a problem with the data, but I've checked it throughout and the data is all valid for the data sources, no NULL, blank or character data.</p>
  
  <p>I'm pretty stumped at this point.  The report compiles and runs just fine in Crystal Reports, using pretty close to the same functions.</p>
  
  <p>If anyone has any recommendations, I'm happy to listen, and I am posting the XML of the report below.</p>
  
  <p>Thank you in advance for any assistance you can offer.</p>
  
  <p>M. Snyder</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"         xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports         http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="MarginRequirement"         language="groovy" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20"         rightMargin="20" topMargin="20" bottomMargin="20" uuid="70f7c2ab-dba2-420a-98b9-        dc041beb65a7"&gt;
          &lt;property name="ireport.zoom" value="1.0"/&gt;
          &lt;property name="ireport.x" value="0"/&gt;
          &lt;property name="ireport.y" value="0"/&gt;
          &lt;property name="ireport.jasperserver.reportUnit"         value="/reports/Risk_Management/MarginRequirement"/&gt;
          &lt;property name="ireport.jasperserver.url"         value="http://reports.beefnw.com/jasperserver/services/repository"/&gt;
  &lt;parameter name="LCF" class="java.lang.Float"&gt;
      &lt;defaultValueExpression&gt;&lt;![CDATA[0.0]]&gt;&lt;/defaultValueExpression&gt;
  &lt;/parameter&gt;
  &lt;parameter name="LCO" class="java.lang.Float"&gt;
      &lt;defaultValueExpression&gt;&lt;![CDATA[0.0]]&gt;&lt;/defaultValueExpression&gt;
  &lt;/parameter&gt;
  &lt;parameter name="FCF" class="java.lang.Float"&gt;
      &lt;defaultValueExpression&gt;&lt;![CDATA[0.00]]&gt;&lt;/defaultValueExpression&gt;
  &lt;/parameter&gt;
  &lt;parameter name="FCO" class="java.lang.Float"&gt;
      &lt;defaultValueExpression&gt;&lt;![CDATA[0.0]]&gt;&lt;/defaultValueExpression&gt;
  &lt;/parameter&gt;
  &lt;parameter name="GF" class="java.lang.Float"&gt;
      &lt;defaultValueExpression&gt;&lt;![CDATA[0.0]]&gt;&lt;/defaultValueExpression&gt;
  &lt;/parameter&gt;
  &lt;parameter name="GO" class="java.lang.Float"&gt;
      &lt;defaultValueExpression&gt;&lt;![CDATA[0.0]]&gt;&lt;/defaultValueExpression&gt;
  &lt;/parameter&gt;
  &lt;queryString&gt;
      &lt;![CDATA[select *,
      if (mid(symbol,-3,1) in("F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"),         "Future", "Option") AS type from margin_requirements
      order by location, clearing_house
      ]]&gt;
  &lt;/queryString&gt;
  &lt;field name="open_price" class="java.lang.Float"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="equity" class="java.lang.Float"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="close_price" class="java.lang.Float"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="open_total_value" class="java.lang.Float"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="close_total_value" class="java.lang.Float"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="liquidating_value" class="java.lang.Float"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="commission" class="java.lang.Float"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="account_id" class="java.lang.Integer"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="position_id" class="java.lang.Integer"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="id" class="java.lang.Integer"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="contract_weight" class="java.lang.Integer"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="contracts" class="java.lang.Integer"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="account_name" class="java.lang.String"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="account_number" class="java.lang.String"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="location" class="java.lang.String"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="clearing_house" class="java.lang.String"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="type" class="java.lang.String"/&gt;
  &lt;field name="group" class="java.lang.String"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="symbol" class="java.lang.String"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="fill_date" class="java.sql.Date"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="updated_at" class="java.sql.Timestamp"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;field name="created_at" class="java.sql.Timestamp"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  &lt;variable name="loc_clHouse" class="java.lang.String" resetType="None"&gt;
      &lt;variableExpression&gt;&lt;![CDATA[$F{location} + " - " + $F{clearing_house}]]&gt;&lt;/variableExpression&gt;
  &lt;/variable&gt;
  &lt;variable name="LC_Orig" class="java.lang.Float" resetType="None"&gt;
      &lt;variableExpression&gt;&lt;![CDATA[$F{group}=="LIVE_CATTLE"?((($F{contracts}*$F{contract_weight}*$F{open_price})/100)*-1) + (($F{contracts}*$F{contract_weight}*$F{close_price})/100):0.0]]&gt;&lt;/variableExpression&gt;
  &lt;/variable&gt;
  &lt;variable name="LCOrig_Total" class="java.lang.Float" resetType="Group" resetGroup="ClearingHouse" calculation="Sum"&gt;
      &lt;variableExpression&gt;&lt;![CDATA[Math.round($V{LC_Orig})]]&gt;&lt;/variableExpression&gt;
  &lt;/variable&gt;
  &lt;variable name="Suppression" class="java.lang.String" resetType="None"&gt;
      &lt;variableExpression&gt;&lt;![CDATA["NO"]]&gt;&lt;/variableExpression&gt;
  &lt;/variable&gt;
  &lt;variable name="LCUpPrice" class="java.lang.Float" resetType="None"&gt;
      &lt;variableExpression&gt;&lt;![CDATA[$F{type}=="Future"?$F{close_price}+$P{LCF}:$F{close_price}+$P{LCO}]]&gt;&lt;/variableExpression&gt;
  &lt;/variable&gt;
  &lt;variable name="LCDownPrice" class="java.lang.Float" resetType="None"&gt;
      &lt;variableExpression&gt;&lt;![CDATA[$F{type}=="Future"?$F{close_price}-$P{LCF}:$P{LCO} &gt; $F{close_price}?0.0:$F{close_price}-$P{LCO}]]&gt;&lt;/variableExpression&gt;
  &lt;/variable&gt;
  &lt;variable name="LC_Decrease" class="java.lang.Float" resetType="None"&gt;
      &lt;variableExpression&gt;&lt;![CDATA[$F{group}=="LIVE_CATTLE"?((($F{contracts}*$F{contract_weight}*$F{open_price})/100)*-1)+(($F{contracts}*$F{contract_weight}*$V{LCDownPrice})/100):0.0]]&gt;&lt;/variableExpression&gt;
  &lt;/variable&gt;
  &lt;variable name="LCDecr_Total" class="java.lang.Float" resetType="Group" resetGroup="ClearingHouse" calculation="Sum"&gt;
      &lt;variableExpression&gt;&lt;![CDATA[Math.round($V{LC_Decrease})]]&gt;&lt;/variableExpression&gt;
  &lt;/variable&gt;
  &lt;variable name="LCIncr_Total" class="java.lang.Float" resetType="Group" resetGroup="ClearingHouse" calculation="Sum"&gt;
      &lt;variableExpression&gt;&lt;![CDATA[Math.round($V{LC_Increase})]]&gt;&lt;/variableExpression&gt;
  &lt;/variable&gt;
  &lt;variable name="LC_Increase" class="java.lang.Float" resetType="None"&gt;
      &lt;variableExpression&gt;&lt;![CDATA[$F{group}=="LIVE_CATTLE"?((($F{contracts}*$F{contract_weight}*$F{open_price})/100)*-1)+(($F{contracts}*$F{contract_weight}*$V{LCUpPrice})/100):0.0]]&gt;&lt;/variableExpression&gt;
  &lt;/variable&gt;
  &lt;group name="ClearingHouse"&gt;
      &lt;groupExpression&gt;&lt;![CDATA[$V{loc_clHouse}]]&gt;&lt;/groupExpression&gt;
      &lt;groupHeader&gt;
          &lt;band height="25"&gt;
              &lt;printWhenExpression&gt;&lt;![CDATA[$V{Suppression}=="YES"]]&gt;&lt;/printWhenExpression&gt;
              &lt;textField&gt;
                  &lt;reportElement uuid="51b78c4d-3747-4282-8b9f-17be6f84feea" x="0" y="0" width="100" height="20"/&gt;
                  &lt;textElement/&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$V{loc_clHouse}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField&gt;
                  &lt;reportElement uuid="ad970881-452b-42aa-bb9f-a19e735643c5" x="179" y="5" width="100" height="20"/&gt;
                  &lt;textElement/&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$V{Suppression}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
          &lt;/band&gt;
      &lt;/groupHeader&gt;
      &lt;groupFooter&gt;
          &lt;band height="116"&gt;
              &lt;textField&gt;
                  &lt;reportElement uuid="79587964-7211-4761-9221-0c063a1aebf0" x="0" y="0" width="100" height="20"/&gt;
                  &lt;textElement/&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$V{loc_clHouse}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField pattern="¤ #,##0.00"&gt;
                  &lt;reportElement uuid="3bd9ce71-5cf4-4ae3-b678-8f3942fc9e7a" x="100" y="0" width="100" height="20"/&gt;
                  &lt;textElement textAlignment="Right"/&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$V{LCOrig_Total}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField pattern="¤ #,##0.00"&gt;
                  &lt;reportElement uuid="20ef4729-88b0-4ab2-a5a6-56594bb716d5" x="100" y="40" width="100" height="20"/&gt;
                  &lt;textElement textAlignment="Right"/&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$V{LCDecr_Total}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField&gt;
                  &lt;reportElement uuid="16a8b6f9-5e24-4ee6-9e84-e2730d78dea1" x="100" y="20" width="100" height="20"/&gt;
                  &lt;textElement textAlignment="Right"/&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$V{LCIncr_Total}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
          &lt;/band&gt;
      &lt;/groupFooter&gt;
  &lt;/group&gt;
  &lt;background&gt;
      &lt;band splitType="Stretch"/&gt;
  &lt;/background&gt;
  &lt;title&gt;
      &lt;band height="79" splitType="Stretch"/&gt;
  &lt;/title&gt;
  &lt;pageHeader&gt;
      &lt;band height="142" splitType="Stretch"&gt;
          &lt;image&gt;
              &lt;reportElement uuid="eef5e5ab-7b5d-4f86-a20f-5dd51bbd56bd" x="5" y="4" width="310" height="93"/&gt;
              &lt;imageExpression&gt;&lt;![CDATA["/home/marlin/bnw_logo_trans.gif"]]&gt;&lt;/imageExpression&gt;
          &lt;/image&gt;
          &lt;rectangle&gt;
              &lt;reportElement uuid="957ac037-7238-46e1-809c-4ded5f76b72b" x="0" y="102" width="572" height="38" forecolor="#E6D8AB" backcolor="#E6D8AB"/&gt;
          &lt;/rectangle&gt;
          &lt;staticText&gt;
              &lt;reportElement uuid="3b2925af-f556-4c0c-84bb-e5b5b021128e" x="126" y="110" width="341" height="30"/&gt;
              &lt;textElement textAlignment="Center"&gt;
                  &lt;font size="18" isBold="true"/&gt;
              &lt;/textElement&gt;
              &lt;text&gt;&lt;![CDATA[MARGIN REQUIREMENT REPORT]]&gt;&lt;/text&gt;
          &lt;/staticText&gt;
      &lt;/band&gt;
  &lt;/pageHeader&gt;
  &lt;columnHeader&gt;
      &lt;band height="27" splitType="Stretch"&gt;
          &lt;rectangle&gt;
              &lt;reportElement uuid="a2f2bf6a-6f14-48e5-9d19-5f153caed5a5" x="0" y="0" width="572" height="27" forecolor="#E6D8AB" backcolor="#E6D8AB"/&gt;
          &lt;/rectangle&gt;
      &lt;/band&gt;
  &lt;/columnHeader&gt;
  &lt;detail&gt;
      &lt;band height="96" splitType="Stretch"&gt;
          &lt;printWhenExpression&gt;&lt;![CDATA[$V{Suppression}=="NO"]]&gt;&lt;/printWhenExpression&gt;
          &lt;textField&gt;
              &lt;reportElement uuid="ed06c6f7-7b44-4033-8c4a-9364d9c22e13" x="100" y="0" width="100" height="20"/&gt;
              &lt;textElement/&gt;
              &lt;textFieldExpression&gt;&lt;![CDATA[$V{LC_Orig}]]&gt;&lt;/textFieldExpression&gt;
          &lt;/textField&gt;
          &lt;textField&gt;
              &lt;reportElement uuid="55b4791f-dfe7-415c-89d5-ebd937c6a329" x="0" y="0" width="100" height="20"/&gt;
              &lt;textElement/&gt;
              &lt;textFieldExpression&gt;&lt;![CDATA[$V{Suppression}]]&gt;&lt;/textFieldExpression&gt;
          &lt;/textField&gt;
          &lt;textField&gt;
              &lt;reportElement uuid="aba93e69-1ab0-476a-81e0-c65d8f482233" x="100" y="40" width="100" height="20"/&gt;
              &lt;textElement/&gt;
              &lt;textFieldExpression&gt;&lt;![CDATA[$V{LC_Decrease}]]&gt;&lt;/textFieldExpression&gt;
          &lt;/textField&gt;
          &lt;textField&gt;
              &lt;reportElement uuid="6f9026a6-abf5-4017-974c-9e972bed8181" x="0" y="20" width="100" height="20"/&gt;
              &lt;textElement/&gt;
              &lt;textFieldExpression&gt;&lt;![CDATA[$P{LCF}]]&gt;&lt;/textFieldExpression&gt;
          &lt;/textField&gt;
          &lt;textField&gt;
              &lt;reportElement uuid="ff53c29d-4006-4b99-8b77-295717483c79" x="0" y="40" width="100" height="20"/&gt;
              &lt;textElement/&gt;
              &lt;textFieldExpression&gt;&lt;![CDATA[$P{LCO}]]&gt;&lt;/textFieldExpression&gt;
          &lt;/textField&gt;
          &lt;textField&gt;
              &lt;reportElement uuid="e305cdbe-e93c-47bb-aedd-f2fc1478e33d" x="100" y="20" width="100" height="20"/&gt;
              &lt;textElement/&gt;
              &lt;textFieldExpression&gt;&lt;![CDATA[$V{LC_Increase}]]&gt;&lt;/textFieldExpression&gt;
          &lt;/textField&gt;
      &lt;/band&gt;
  &lt;/detail&gt;
  &lt;columnFooter&gt;
      &lt;band splitType="Stretch"/&gt;
  &lt;/columnFooter&gt;
  &lt;pageFooter&gt;
      &lt;band height="54" splitType="Stretch"/&gt;
  &lt;/pageFooter&gt;
  &lt;summary&gt;
      &lt;band height="42" splitType="Stretch"/&gt;
  &lt;/summary&gt;
      &lt;/jasperReport&gt;
  </code></pre>