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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>iReport</strong> <strong>Ultimate</strong> <strong>Guide</strong>Figure 14-4Query resultSo let’s summarize the steps to create this list:1. We started by adding the List element to a band, in this case, the Title band. When we add the element, <strong>iReport</strong> creates anew subdataset and ties it to the dataset run of the report.2. The next step is to configure the subdataset, which holds the data that will appear in the report. We do that by setting thequery of the subdataset by right-clicking the subdataset node in the Report Inspector view and by selecting the menu itemEdit Query. The query we used in the sample is the one seen above to select countries and the relative orders count. Thequery contains two fields, SHIPCOUNTRY and C, which are added to the subdataset fields list.3. The next step of the data configuration is the configuration of the dataset run, defined by right-clicking the List elementand selecting Edit List Datasource. In the Dataset Run box we change the Connection/Datasource expression to usethe same connection that is used to populate the whole report (by selecting Use Connection expression from theexpression type combo box).4. The last step is setting the contents of the List element. We drag the two fields (step step 2) over the element and weadjust their size and position. As we said, whatever we put inside the element will be repeated for every record of thedataset. The content of the element becomes more or less like the content of a Detail band, which, similarly, is repeatedfor each record. Figure 14-4 should clarify that. For each country, we see the country name and the number of orders. Theframe around the list is not part of the list; as explained before, we have put the list inside a Frame element in order toprint a border around it (the thickness of the Frame border is set to 1 pixel).14.1.2 Parameters and Variables in a List ElementThe data printed in a List element comes from the subdataset tied to it. A subdataset can have not only fields, but parametersand variables as well. Parameters can be used in the where condition of an SQL query and in many other ways. Their valuesare set on the Parameters tab of the Dataset Run window (Figure 14-1). The value expressions can contain the main reportobjects (fields, parameters, and variables coming from the main dataset).Suppose an example has a report that prints a set of customers. You want to use a List element to print the list of emailaddresses of each customer. In the Detail band of our report, we will place textfields to show the customer name, the customer280

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

Saved successfully!

Ooh no, something went wrong!