Changes

Jump to: navigation, search

Create iReport Templates with Subreports

170 bytes added, 14:45, 30 September 2013
no edit summary
:Step 5 – Add Subreport Parameter to the Main report
====''Step 1 – Create the Main Report''====__NOEDITSECTION__
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.
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 are the instructions to create a subreport:
# The sub-report displays.
====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.
# Save the subreport.
====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===__NOEDITSECTION__
{| class="wikitable"
| align="center" style="background:#f0f0f0;"|'''Main Report'''
4,913
edits

Navigation menu