Jump to: navigation, search

Create iReport Templates with Subreports

163 bytes added, 18:24, 12 February 2014
Version 6.0
# Select the desired iReport Template to apply (Blank is recommended).
#:[[Image:IReportSubReport2.png|center|500px|''Select the desired iReport Template'']]
# Select from the '''Connection/Data Source''' list. This should be the IMSMA item determined as the secondary data of your report. For example, if you are creating a report about Land with Progress Reports, then “Activity” “Hazard Reduction” should be the data source for the sub-report. Click Next.
#:[[Image:IReportSubReport3.png|center|500px|''Select the desired datasource'']]
# Select the attributes to be included in your sub-report. Click '''Next'''.
#:[[Image:IReportSubReport4.png|center|500px|''Select the desired fields for the subreport'']]
# Select the fields to group by. This step is not required. Click '''Next'''.
#:[[Image:Subreport_Group_by.png|center|500px|''Select the fields to group by'']]
# Enter a name for the sub-report or use the default. Choose '''Next'''.
#:[[Image:IReportSubReport5.png|center|500px|''Enter a name for the subreport'']]
====Step 4 – Define Report Query for Subreport====__NOEDITSECTION__
The next step is to create a report query for the subreport you just created in Step 3 to define how the IMSMA item on the Main report is related to the IMSMA item on the subreport. Typically the subreport Report Query will receive the guid from the main report via the parameter created in Step 4 and then use it to limit items in the subreport to the those linked to the main report. Below is the instructions on how to define the Report Query:
# Open the [[Modify an iReport Template#Using Report Query filters|Report Query window]].
# From the Report query window, select '''ImsmaQuery''' from the Query language list.
# Enter a Report Query filter using the parameter defined above to limit the objects according to the main report object. The most common Report Query filter would be to filter to only linked objects. For example '''''links.toGuid="$P{ItemGUID}"'''''. In this step, the Report Query tells the subreport to return only rows that are linked to the guid of the the item in the main report via the link table. Other combinations of Report Query filters can be used on subreports beyond the link table. These are documented in the [[#Example Subreport Relationships|Possible Subreport Relationships]] section below.
# Click '''OK'''. :The Report query window closes.
# Save the subreport.
# For the '''value expression''', select the appropriate field to include in the parameter. '''Normally this is ''$F{guid}''''' but other choices are available.
#: [[Image:IReport_SubReportParameter2.png|center|200px|''Select the appropriate field'']]<div align="center">''Select the field to include in the parameter''</div>
# Click '''OK''' and close Subreport properties windowsParameters window.
==Kinds of Subreports==__NOEDITSECTION__

Navigation menu