Changes

Jump to: navigation, search

Create iReport Templates with Subreports

4 bytes added, 16:48, 28 January 2014
Version 6.0
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.
====Step 5 – Add Subreport Parameter to Main Report====__NOEDITSECTION__
We created a parameter on the sub-report to connect to the Main report in Step 43, now we need to create a parameter on the Main report as well. Below is the instructions to create the parameter you need for the Main report:
# Make sure you are at the Main report by selecting the name of the Main report from the tabs at the top of the iReport Designer canvas pane.
# Select the subreport box within the Main report.
==Kinds of Subreports==__NOEDITSECTION__
There are three main kinds of relationships in IMSMA on which subreports can be generated from IMSMA data. These are:
*Location relationship
*Link relationship
To create a subreport using the Location relationship:
# From the main "Location" report, pass the location '''''guid''''' to the subreport in a parameter (e.g. in a parameter called '''ItemGUID''').
# Create a parameter on the subreport with the same name as in #1.
# In the subreport for the related item (e.g. a Victim) use the parameter in the following ImsmaQuery language syntax
location.guid="$P{parametername}"
This has the effect of limiting the subreport records to '''only those records that are associated to the location'''' from the main report.
===Link relationship subreports===__NOEDITSECTION__
To create a subreport using the link relationship:
# From the main report, pass the '''''guid''''' of the main report object to the subreport in a parameter (e.g. pass an accident's '''''guid''''' in a parameter called '''ItemGUID''').
# Create a parameter on the subreport with the same name as in #1.
# In the subreport for the related item (e.g. a Victim) use the parameter in the following ImsmaQuery language syntax
518
edits

Navigation menu