Changes

Jump to: navigation, search

Create iReport Templates with Subreports

2,793 bytes added, 14:16, 19 September 2013
Various Kinds of Subreports
<p>Once you have all the sub-reports created for your Main report, you can compile and run your Main report.</p>
==Various Kinds of Subreports==
There are three main kinds relationships in IMSMA on which subreports can be generated from IMSMA data. These are:
*Location relationship
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:iRep13iRep14.png|center|500px|''Figure 1314. location_guidexample'']]<div align="center">''Figure 14. location_guid example''</div> ===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 1321. location_guidDirect relationships vs. Links''
</div>
The location_guid 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 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 report on different items that linked to the item in the main report, you may create a new sub-report for each linked item. For example, to create a report of land and the accidents and activities that are linked to those land, you would create the main report on land. This report would then contain a sub-report to list linked accidents, and another sub-report to list linked activities.   *Accident *Activity*Assistance *Education*Land*QM*Victimmust 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. [[:Image:iRep14.png|Figure 14]] 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'']]
''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

Navigation menu