title: Pass values from main report to sub report?
body: <p>I just started to work with iReport and got the task to do some changes to already existing reports.</p>
  
  <p>Currently there's a main report with section A and B (contact details and some other info). There is a sub report C and then a subreport D. My task is to replicate A and B for every item in D. If the report has many D sections I want to have an A and B for each.</p>
  
  <p>All data is in the same XML document and to get the data for section A and B I have simply</p>
  
  <pre><code>((net.sf.jasperreports.engine.data.JRXmlDataSource)$F{REPORT_DATA_SOURCE}).dataSource("/Header/")
  </code></pre>
  
  <p>and for sub report with D section </p>
  
  <pre><code>((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/Header/ProductHeader/Member")
  </code></pre>
  
  <p>if I drag a field from Document Structure that displays data in Section A to section D and check the expression it says
  $F{ContactNumber} but displays Null in D even though it displays a value in section A</p>
  
  <p>How do I need to modify my data sources to display content of A and B in D?</p>
  
  <p>Thanks in advance</p>