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.

Lists, Tables, and Barcodesidentifier, the phone number, and finally the List element to print the list of email addresses. The subdataset query used toextract the email addresses would look like this:SELECT email from EMAIL_ADDRESSES where CUSTOMER = $P{CustomerID}In the where condition, the customer ID parameter ($P{CustomerID}) is used to select the email addresses from thehypothetical table called EMAIL_ADDRESSES. We’ll assume that we have a field in the main dataset. In order to pass thevalue of the dataset’s CUSTOMER_ID field to the subdataset, the value of the CustomerID parameter in the dataset run will beset to $F{CUSTOMERID} (Figure 14-5).Figure 14-5Dateset Run parametersAt run time, UR will process all the customers and fill a detail for each one. Every time the List element isencountered in the details, the report engine will analyze the dataset run to prepare the data acquisition; the value of theparameter $P{CustomerID} will be set to the current value of the field CUSTOMERID and the query of the subdataset will beexecuted. The query result will contain all the email addresses associated with the current customer ID.If you used parameters with subreports before, you will find this concept to set the value of a subdataset parameter using anexpression very familiar. As we said, the mechanisms of the subdataset run and dataset run are the same ones used to feedcharts and crosstabs. The big difference here is that while charts and crosstabs can use the main dataset, a List can only use asubdataset.In a List element, we can print fields (as we have seen in Figure 14-3), and we can print parameters and variables of thesubdataset in the same way (using, for instance, a textfield and any expression that uses combinations of these objects). Thevariables printed must be defined in the List subdataset. Figure 14-6 shows the same List element as Figure 14-4 but with anextra column that is created from a variable that sums the number of orders cumulatively.281

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

Saved successfully!

Ooh no, something went wrong!