Changes

Create iReport Templates with Subreports

1,261 bytes removed, 14:21, 19 September 2013
Link relationship subreports
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
[[Image:iRep21.png|center|500px|''Figure 21. Direct relationships vs. Links'']]
<div align="center">
''Figure 21. Direct relationships vs. Links''
</div>
The process for creating a report on an item and its linked items is similar to the process for creating a report on items with a direct Location relationship. The item in the main report is the primary item for which you would like to find linked items. The sub-report would return the records for the particular item that is linked to the primary item. The key difference is the query used in the sub-report.
If you would like to To create a subreport using the link relationship:# From the main report on different items that linked to , pass the item in '''''guid''''' of the main report, you may create object to the subreport in a parameter (e.g. pass an accident's '''''guid''''' in a parameter called '''ItemGUID''')# Create a new sub-report parameter on the subreport with the same name as in #1.# In the subreport for each linked the related item(e.g. For example, to create a report of land and Victim) use the accidents and activities that are linked to those land, you would create parameter in the main report on land. This report would then contain a sub-report to list linked accidents, and another sub-report to list linked activitiesfollowing ImsmaQuery language syntax links.toGuid="$P{parametername}"
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.
 
*Accident
*Activity
*Assistance
*Education
*Land
*QM
*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}"
 
The location guid field in the subreport item table contains the guid of the location to which the item record is associated. The figure below shows an example of a location and the accident and land that are associated to the location. Notice that the location_guid value (1234-1234) in the accident and land are identical to the location_guid of the location.
 
[[Image:iRep14.png|center|500px|''Figure 14. location_guid example'']]
<div align="center">
''Figure 14. location_guid example''
</div>
===Direct Relationships===
This section discusses relationships between Items in IMSMA and also provides instructions on how to create a specific report/sub-reports. The reports discussed so far in this training module have been based on a single data source. In this part of the training module, you will learn to create more complex reports that reference multiple data sources. Some items are dependent on the existence of another item. This type of relationship is referred to as a direct relationship. For example, an accident, land, activity, education, QM, or victim has a direct relationship to the location to which it is associated. The accident, land, activity, education, QM, or victim cannot exist unless it is associated with a location. This direct relationship is enforced in IMSMA via the reconciliation process.</p>
319
edits