Changes

Jump to: navigation, search

Create iReport Templates with Subreports

126 bytes removed, 15:06, 20 September 2013
no edit summary
# 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 [[#Possible Example Subreport Relationships|Possible Subreport Relationships]] section below.
# Click '''OK'''. :The Report query window closes.
# Save the subreport.
=====Possible Subreport Relationships=====__NOEDITSECTION__{| class="wikitable"| align="center" style="background:#f0f0f0;"|'''Main Report'''| align="center" style="background:#f0f0f0;"|'''Subreport can be'''| align="center" style="background:#f0f0f0;"|'''Value to Pass to Subreport'''| align="center" style="background:#f0f0f0;"|'''Report Query'''|-| Location||Any Item with a Location||location guid||location.guid = "$P{ItemGUID}"|-| Any linked item||Any linked Item||Item guid (e.g. Land guid)||links.toGuid="$P{ItemGUID}"|-| Activity||Impact survey, Interviewee, or Vegetation removal||Activity guid||hazreduc.guid = "$P{ItemGUID}"|-| Interviewee||Question||interviewee guid||interviewee.guid = “$P{ItemGUID}”|-| Task||Work Item||Task guid||task.guid = "$P{ItemGUID}"|-| Any Item with Geospatial information||GeospatialInfo||geoSpatialInfos||guid IN $P{GeospatialInfoList}|-| Geospatial Info||GeoPoint||GeospatialInfo guid||geospatialInfoGuid = "$P{ItemGUID}"|-| Any item with devices||Item Device (e.g. AccidentDevice)||Item guid (e.g. Accident guid)||accident.guid = "$P{ItemGUID}" hazard.guid = "$P{ItemGUID}"|-| MRE||MREDetail||MRE guid||mre.guid = "$P{ItemGUID}"|-| Victim||Victim Needs Assessment||victim guid||victim.guid="$P{ItemGUID}"|-| Victim||Victim Cause||victim guid||victim.guid="$P{ItemGUID}"|-| Victim Assistance||Victim Assistance Assistance||victimAssistance.guid||victimAssistance.guid="$P{ItemGUID}"|-| Task||Objective||SQL Field list of Objectives||guid IN ($P{SQLList})|-| Work Item||Linked Items (Activity, Education, QM, Victim Assistance)||SQL Field list of Items||guid IN ($P{SQLList})|-| |} ====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 4, 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.
# Click '''OK''' and close Subreport properties windows.
==Kinds of Subreports==__NOEDITSECTION__
There are three main kinds relationships in IMSMA on which subreports can be generated from IMSMA data. These are:
*Location relationship
*Other relationship
===Location relationship subreports===__NOEDITSECTION__Because each of the main items in {{IMSMANG}},*Accident *, Activity*, Assistance *, Education*, Land*, QM*, and Victim, must be reconciled to a Location during the data entry phase, each of these objects has a relationship with Location and can thus be a subreport on a Location main report. Since all accidents, land, activities, educations, QMs, assistances, and victims are associated with a single location each record knows what location it is related to based on the '''''location guid''''' field. When creating a report where the main report is a Location and the subreport is one of the associated objects the Location's guid is passed to the subreport in a parameter and the subreport can use a special ImsmaQuery language syntax to limit the subreport data to those associated with the main report's location:
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__
In addition to the Location relationship, the main items in {{IMSMANG}} can also be linked with one another during the reconciliation process. This is how, for example, Activities are linked with Land in the {{IMSMANG}} database. Accidents, land, activities, educations, assistances, QMs, and victims may be related to one another via ''links''. For example, a victim may be associated to an accident in a particular land. If these relationships are known, IMSMA users may define these links while reconciling the Data Entry Form. This special relationship can also be modeled in iReport using a report and subreport
This has the effect of limiting the subreport records to only those records that have a '''link''' to the guid or object passed from the main report.
===Geospatial relationships===__NOEDITSECTION__
In addition to Location and Link relationships, many objects in IMSMA can store geospatial/geographic information (i.e. point/polygon information). This relationship with the geospatial data can be modeled in a report/subreport relationship for any item that has geospatial information associated with it. To include point/polygon information on an object's main report, follow 3 basic steps:
This has the effect of limiting the Geospatial records to only those records whose guid is linked to the geospatialinfo of the main report.
===Other subreport relationships===__NOEDITSECTION__
Certain items in {{IMSMANG}} have subsets of data that are contained within them. For example, an education may have education details such as the education type, total audience, and percentage of women and men. Examples of other subreport relationships include:
The process for creating a report on a parent item and its children is the same as any other report/subreport relationship.
===Example Subreport Relationships==={| class="wikitable"| align="center" style="background:#f0f0f0;"|'''Main Report'''| align="center" style="background:#f0f0f0;"|'''Subreport can be'''| align="center" style="background:#f0f0f0;"|'''Value to Pass to Subreport'''| align="center" style="background:#f0f0f0;"|'''Report Query'''|-| Location||Any Item with a Location||location guid||location.guid = "$P{ItemGUID}"|-| Any linked item||Any linked Item||Item guid (e.g. Land guid)||links.toGuid="$P{ItemGUID}"|-| Activity||Impact survey, Interviewee, or Vegetation removal||Activity guid||hazreduc.guid = "$P{ItemGUID}"|-| Interviewee||Question||interviewee guid||interviewee.guid = “$P{ItemGUID}”|-| Task||Work Item||Task guid||task.guid = "$P{ItemGUID}"|-| Any Item with Geospatial information||GeospatialInfo||geoSpatialInfos||guid IN $P{GeospatialInfoList}|-| Geospatial Info||GeoPoint||GeospatialInfo guid||geospatialInfoGuid = "$P{ItemGUID}"|-| Any item with devices||Item Device (e.g. AccidentDevice)||Item guid (e.g. Accident guid)||accident.guid = "$P{ItemGUID}" hazard.guid = "$P{ItemGUID}"|-| MRE||MREDetail||MRE guid||mre.guid = "$P{ItemGUID}"|-| Victim||Victim Needs Assessment||victim guid||victim.guid="$P{ItemGUID}"|-| Victim||Victim Cause||victim guid||victim.guid="$P{ItemGUID}"|-| Victim Assistance||Victim Assistance Assistance||victimAssistance.guid||victimAssistance.guid="$P{ItemGUID}"|-| Task||Objective||SQL Field list of Objectives||guid IN ($P{SQLList})|-| Work Item||Linked Items (Activity, Education, QM, Victim Assistance)||SQL Field list of Items||guid IN ($P{SQLList})|-| |}
{{NavBox HowTo use iReport}}
319
edits

Navigation menu