title: JasperReport: How to use subreport return values as input for Main Report Variable Calculation
body: <p><strong>Scenario:</strong></p>
  
  <p>I've two reports: <strong>Main Report</strong> (let's call it, A) and <strong>sub-report</strong> (let's call it, B).</p>
  
  <p>Report A contains sub-report B at the detail band, so sub-report B is displayed for each element at the Report A datasource. Sub-report B also returns a variable to the Main report A.</p>
  
  <p><strong>What I want</strong> is to sum those return values from sub-report B and totalize them at the Main report summary.</p>
  
  <p>To do that, I have tried to create a new report variable that sum those returns values... Something like this: </p>
  
  <p><img src="https://i.stack.imgur.com/msFno.png" alt="Variable Definition Example"></p>
  
  <p>However, I've found that such variables expression are always evaluated before the band detail is rendered, so I always miss the first sub-report return value...</p>
  
  <p>Sadly, the evaluation time (as this <a href="https://community.jaspersoft.com/questions/822314/return-variables-and-evaluation-time" rel="noreferrer">link</a> says) cannot be changed on those kind of variables, so I'm stuck...</p>