13.07.2015 Views

iReport Ultimate Guide - Nimsoft Library

iReport Ultimate Guide - Nimsoft Library

iReport Ultimate Guide - Nimsoft Library

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>iReport</strong> <strong>Ultimate</strong> <strong>Guide</strong>The vertical dimension is not important because, when you print the report, UR will use all the vertical spacenecessary, regardless of the element size (see Figure 10-12).3. Select the subreport element so that the property sheet shows its properties (Figure 10-13).Figure 10-13 Subreport properties4. We want to use the same database connection we used with the master report to populate the subreport, so set theconnection type to Use a connection expression. The expression will be just $P{REPORT_CONNECTION}.As explained, REPORT_CONNECTION is a built-in parameter holding a reference to the connection used in the report.5. Next, define the subreport expression; it is used by UR to locate the report that will be inserted as a subreport.Assuming the subreport Jasper file is in the classpath (from an <strong>iReport</strong> perspective it’s enough that it is in the samedirectory as the master report), the expression we’ll use is this:“subreport.jasper”6. Finally, since the subreport we are using requires the COUNTRY parameter, add a subreport parameter (by clicking on the ...button of the Parameters property). Click Add and set the subreport parameter name COUNTRY (the name must matchthe parameter name we defined in step step 3 on page 157); as expression for the value, we choose the field containingthe country name, that is, $F{SHIPCOUNTRY} (step step 3 on page 156).7. Preview the report. If everything has been done correctly, you should get a result like the one shown in Figure 10-14.160

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!