Changes

Jump to: navigation, search

Create iReport Templates with Subreports

204 bytes added, 21:37, 19 September 2013
no edit summary
}}
==Sub-Reports==__NOEDITSECTION__
<p>Sub-report is reports within a report; thus, providing a way to generate a report that includes data on the target IMSMA Item as well as data on other IMSMA Items that are associated to the target IMSMA Item. Generally a sub-report is used in a situation where you have one or more sets of data relating to a single IMSMA item. A common use case would be a Location report with multiple details bands of different IMSMA items (Land, Activity, Accident, Victim, Education, and QM).</p>
<p>Regardless of what IMSMA data you’re including in your report and sub-reports, there are 6 basic steps to create a report with sub-reports:</p>
[[Image:iRepStep01.png|center|500px|''Step 1 – Create the Main Report'']]
====''Step 1 – Create the Main Report''====__NOEDITSECTION__
<p>Before creating the main report, you will need to determine what data to be included on your report. For example, if you are creating a report about Land with all the Progress Report data, then the target IMSMA item for your main report should be Land and the target data for your sub-report should be Activity assuming that Progress Reports are entered into the system as Activity. Below is a list of questions and things to be considered when designing a report.</p>
The Main report should be created with the IMSMA item determined to be the primary data of your report. The Main report is just a basic report and can be created using the steps provided in the [[Create a Basic i-Report Template]] section.
====''Step 2 – Add Subreport to the Main report''====__NOEDITSECTION__
Once the main report has been created you can add a subreport to the main report. The intent of the subreport is to bring data from a different but related datasource into the main report. For example, you could include Activity data on a report about Land. Below is the instructions to create a sub-report:</p>
[[Image:iRepStep03.png|center|500px|''Step 3 – Add Parameter to Sub-report'']]
====Step 3 – Add Parameter to Subreport====__NOEDITSECTION__
To connect a subreport to the Main report, we next need to create a parameter for passing the identification (guid) of the primary IMSMA Item between the subreport and the main report. In the '''Report Inspector''' on the subreport, [[Modify an iReport Template#Adding a Parameter to an iReport Template|add a Parameter]] to hold the guid of the IMSMA Item on the main report. It is recommended to add a fairly generic parameter name such as ''ItemGUID'' so that the subreport can be more easily re-used.
$P{ItemGUID}
====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:
# Save the subreport.
=====Possible Subreport Relationships=====__NOEDITSECTION__
{| class="wikitable"
| align="center" style="background:#f0f0f0;"|'''Main Report'''
|}
====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:
<p>Once you have all the sub-reports created for your Main report, you can compile and run your Main report.</p>
==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
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:
4,913
edits

Navigation menu