iReport Ultimate Guide - Nimsoft Library

iReport Ultimate Guide - Nimsoft Library iReport Ultimate Guide - Nimsoft Library

13.07.2015 Views

iReport Ultimate GuideFigure 11-23 The master report with the two subreports for addresses and hobbiesIn the Detail band, position the id, lastname, and firstname fields. Underneath these fields, add the two Subreportelements, the first for the e-mail addresses, the second for the hobbies.The e-mail and hobby subreports are identical except for the name of the field in each one (see Figure 11-22). The two reportsshould be as large as the Subreport elements in the master report, so remove the margins and set the report width accordingly.Figure 11-24 The subreport layoutPreview both the subreports just to compile them and generate the relative .jasper files. You will get an error during the fillprocess, but it’s okay. We have not set an Xpath query, so UR is not able to get any data. You can resolve theproblem by setting a simple Xpath query (it will not be used in the final report), or you can preview the subreport using anempty data source (you will have to select it from the combo box in the tool bar).When the subreports are done, execute the master report. If everything is okay, you will see the print shown in Figure 11-25.It displays people grouped by home and work categories and the subreports associated with every person.194

Data Sources and Query ExecutersFigure 11-25 The first page of the final resultAs this example demonstrates, the real power of the XML data source is the versatility of XPath, which allows navigating thenode selection in a refined manner.11.6.6 Using CSV Data SourcesInitially, the data source for CSV documents was a very simple data source proof-of-concept that showed how to implement acustom data source. The CSV data source interface was improved when UR added a native implementation to fill areport using a CSV file.To create a connection based on a CSV file, click the New button in the Connections/Datasources dialog box and select FileCSV data source from the data source types list to bring up the dialog box shown in Figure 11-26.195

Data Sources and Query ExecutersFigure 11-25 The first page of the final resultAs this example demonstrates, the real power of the XML data source is the versatility of XPath, which allows navigating thenode selection in a refined manner.11.6.6 Using CSV Data SourcesInitially, the data source for CSV documents was a very simple data source proof-of-concept that showed how to implement acustom data source. The CSV data source interface was improved when UR added a native implementation to fill areport using a CSV file.To create a connection based on a CSV file, click the New button in the Connections/Datasources dialog box and select FileCSV data source from the data source types list to bring up the dialog box shown in Figure 11-26.195

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

Saved successfully!

Ooh no, something went wrong!