Changes

Jump to: navigation, search

Create iReport Templates with Subreports

1,625 bytes removed, 02:38, 18 September 2013
Sub-Report
# Enter a name for the sub-report or use the default. Choose '''Next'''.
#:[[Image:IReportSubReport5.png|center|500px|''Enter a name for the subreport'']]
# Select '''Use the same connection use to fill master report'''. Click Finish. The sub-report displays.
#:[[Image:IReportSubReport6.png|center|500px|''Use same connection'']]
# The sub-report displays.
[[Image:iRepStep03.png|center|500px|''Step 3 – Add Parameter to Sub-report'']]
 
====Step 3 – Add Parameter to Sub-report====
<p>To connect a sub-report to the Main report, we need to create a parameter for passing the identification (guid) of the primary IMSMA Item between the sub-report and the main report. Below is the instructions to create the parameter you need for the sub-report:</p>
<ol start="# In the '''Report Inspector''' on the subreport, [[Modify an iReport Template#Adding a"><li>At Parameter to an iReport Template|add a Parameter]] to hold the guid of the IMSMA Item on the Sub-main report window, select View . It is recommended to add a fairly generic parameter name such as ''ItemGUID'' so that the subreport can be more easily re-> Parametersused.
:The window displays the parameters.
</ol># Once the parameter is added it will be available in the '''Report Inspector''' and can be referenced as ''$P{parametername}''. For example: $P{ItemGUID}
[[Image:iRep09.png|center|500px|''Figure 9. Window of fields, variables, and parameters'']]<div align="center">''Figure 9. Window of fields, variables, and parameters''</div>===Step 4 – Define Report Query for Sub-report====
<ol type="The next step is to create a" start="2"><li>Click the '''New''' button.</li>:The Add/modify parameter window displays.<li>From the Add/modify parameter window:</li>*Enter “'''''object_guid'''''” report query for the '''Parameter Name''' where ''object_guid'' is the suggested parameter name sub-report you just created in Step 3 to define how the Column D of IMSMA item on the Table - Required Parameters for Sub-Main report below.*Click is related to the IMSMA item on the '''OK''' buttonsubreport. <li>Close Below is the window that displays instructions on how to define the list of all parameters.</li></ol>Report Query:
# Open the [[Image:iRepStep04.png|center|500pxModify an iReport Template#Using Report Query filters|''Step 4 – Define Report Query for Sub-report''window]] ====Step 4 – Define # From the Report Query for Sub-report====__NOEDITSECTION__ <p>The next step is to create a report query for the sub-report you just created in Step 2 to define how the IMSMA item on the Main report is related to the IMSMA item on the Sub-report. Below is the instructions on how to define the Report Query:</p> <ol start="23"><li>At the Sub-report window, select Data -> Report Query.</li>:The Report query window displays. <li>From the Report query window:</li><ol type="a" start="3"><li>Select ImsmaQuery from the Query language list.</li><li># Enter object.guid = “$P{object_guid}” for a Report Query filter using the ImsmaQuery where object is parameter defined above to limit the object type of the IMSMA item on the Main report - See Column E in the Table - Required Parameters for Sub-report below objects according to determine the ImsmaQuery string for your Sub-main reportobject.</li></ol></ol> [[Image:iRep10The most common Report Query filter would be to filter to only limited objects.png|center|500px|For example '''Figure 10. Define Report Query for Sub-report'']]<div alignlinks.toGuid="center$P{ItemGUID}">''Figure 10'''. Define See the table below for other combinations of Report Query for Sub-report''</div> <ol><ol type="a" start="5">filters to use on subreports.<li># Click '''OK'''.</li>:The Report query window closes. <li>Click # Save the [[Image:iRepCompile.png]] button to compile the sub-reportsubreport.</li></ol></ol>
[[Image:iRepStep05{| class="wikitable"|-! Main Report!! Subreport can be !! Value to Pass to Subreport !! Report Query !! Header text|-| Location || Any Item with a Location|| location guid || location.pngguid = "$P{ItemGUID}" || Example|-| Land, Activity, Accident, Victim, Assistance, Education, QM, Location ||centerAny linked Item |500px|''Step 5 – Add Subreport Parameter item guid (e.g. Land guid) || links.toGuid="$P{ItemGUID}" || Example |-|Activity || hazreduc_guid|| Impact survey, Interviewee, or Vegetation removal || hazreduc.guid = "$P{hazreduc_guid}" || Relationship is defined as “New” to an activity during the reconciliation.|-| Interviewee || interviewee_guid || Question || interviewee.guid = “$P{ interviewee_guid}” || Relationship persisted automatically when Questions are entered for each Interviewee at Data Entry Form.|-| Victim || victim_guid || Received Educations || victim.guid = "$P{victim_guid}" || Relationship is defined as “New” to a Victim during the reconciliation.|-| Task || task_guid || Work Item || task.guid = "$P{ task_guid}" || Relationship is defined when adding a new Work Item to Main Report'']]a Task at the Task Editor Window.|-| Example || Example || Example || Example || Example|}
====Step 5 – Add Subreport Parameter to Main Report====__NOEDITSECTION__
<p>Below is the table listing typical parameters required for both Main report and Sub-report.</p>
<table border="1">
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
<td>E</td>
<td>F</td>
</tr>
<tr>
<td>If your Main report is</td>
<td>Sub-report parameter on Main report</td>
<td>Your Sub-report can be…</td>
<td>Parameter on Sub-report</td>
<td>Report Query defined on Sub-report</td>
<td>Comments</td>
</tr>
<tr>
<td>Location</td>
<td>location_guid</td>
<td>Land,
Activity,
Accident,
Victim,
Education, or
QM
</td>
<td>location_guid</td>
<td>location.guid = "$P{location_guid}"</td>
<td>Relationship is defined as “New” to a Location during the reconciliation. </td>
</tr>
<tr>
<td>Land, Activity,
Accident,
Victim,
Education, or
QM
</td>
<td>object_guid</td>
<td>Land, Activity,
Accident,
Victim,
Education, or
QM
</td>
<td>object_guid</td>
<td>links.toGuid = "$P{ object_guid}"</td>
<td>Relationship is defined using “Link” during the reconciliation.</td>
</tr>
<tr>
<td>Education</td>
<td>education_guid</td>
<td>Education Detail</td>
<td>education_guid</td>
<td>education.guid = "$P{education_guid}"</td>
<td>Relationship is defined as “New” to an Education during the reconciliation.</td>
</tr>
<tr>
<td>Activity</td>
<td>hazreduc_guid</td>
<td>Impact survey,
Interviewee, or
Vegetation removal
</td>
<td>hazreduc_guid</td>
<td>hazreduc.guid = "$P{hazreduc_guid}"</td>
<td>Relationship is defined as “New” to an Activity during the reconciliation.</td>
</tr>
<tr>
<td>Interviewee</td>
<td>interviewee_guid</td>
<td>Question</td>
<td>interviewee_guid</td>
<td>interviewee.guid = “$P{ interviewee_guid}”</td>
<td>Relationship persisted automatically when Questions are entered for each Interviewee at Data Entry Form.</td>
</tr>
<tr>
<td>Victim</td>
<td>victim_guid</td>
<td>Received Educations</td>
<td>victim_guid</td>
<td>victim.guid = "$P{victim_guid}"</td>
<td>Relationship is defined as “New” to a Victim during the reconciliation.</td>
</tr>
<tr>
<td>Task</td>
<td>task_guid</td>
<td>Work Item</td>
<td>task_guid</td>
<td>task.guid = "$P{ task_guid}"</td>
<td>Relationship is defined when adding a new Work Item to a Task at the Task Editor Window.</td>
</tr>
</table>
<p>The following section of the Advance Reports chapter discusses relationships between Items in IMSMA and also provides instructions on how to create a specific report/sub-reports.</p>
319
edits

Navigation menu