title: How to sum 2 variables and store it into one variable
body: <p>I have a mainreport containing 2 different subreports. </p>
  
  <p>I have a variable sum from a subreport1 for example 10(type Integer)</p>
  
  <p>I have another variable sum from another subreport2 for example 2(type Integer)</p>
  
  <p>I have <strong>successfully retreived the 2 variables from each of the subreports</strong>
  now I want to create a variable in my mainreport that sums up the 2 variables</p>
  
  <p>so now in my mainreport I have 3 variables </p>
  
  <p>the first variable is called VAR1 and it came  from subreport 1 </p>
  
  <pre><code>Name                       VAR1
  Variable Class             java.lang.Integer
  Reset type                 Report
  initial Value Expression   0
  </code></pre>
  
  <p>the second variable is called VAR2 and it came  from subreport 2</p>
  
  <pre><code>Name                       VAR2
  Variable Class             java.lang.Integer
  Reset type                 Report
  initial Value Expression   0
  </code></pre>
  
  <p>the last variable is called SUM</p>
  
  <pre><code>Name                       SUM
  Variable Class             java.lang.Integer
  Reset type                 Report
  variable expression        new Integer($V{VAR1}.intValue() + $V{VAR2}.intValue() )
  initial Value Expression   0
  </code></pre>
  
  <p>The SUM variable is NULL when i preview the pdf , VAR1 and VAR2 are Integer values but the SUM variable is always NULL</p>
  
  <p>could it be that the SUM was evaluated before VAR1 and VAR2?</p>
  
  <p>what is my problem? </p>