Changes

Jump to: navigation, search

Create iReport Templates with Subreports

8,135 bytes removed, 21:32, 20 February 2020
no edit summary
==Advanced Reports=={{TOC right}}===Sub-Report=Creating Subreports==__NOEDITSECTION__<p>Sub-A subreport is a report is reports within a report; thus, providing a way to generate a report that includes data on the target IMSMA Item item as well as data on other IMSMA Items items that are associated to the target IMSMA Itemitem. Generally a sub-report subreport 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 (HazardLand, Hazard ReductionActivity, Accident, Victim, MREEducation, and QCQM).</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>
Regardless of what IMSMA data you’re including in your report and subreports, there are 5 basic steps to create a report with subreports::Step 1 – Create the Main main report:Step 2 – Add Sub-report a subreport to the Main main report:Step 3 – Add Parameter a parameter to the Sub-reportsubreport:Step 4 – Define Report Query the report query for the Sub-reportsubreport:Step 5 – Add Sub-report Parameter subreport parameter to the Main main report:Step 6 – Repeat Step 2-5 for additional Sub-reports
[[Image:iRepStep01.png|center|500px|''====Step 1 – Create the Main Report'']]====__NOEDITSECTION__
====''Step 1 – Create the Main Report''==== <p>Before creating the main report, you will need to determine what data to should be included on in your report. For example, if you are creating a report about Hazard Land with all the Progress Report data, then the target IMSMA item for your main report should be Hazard Land and the target data for your sub-report subreport should be Hazard Reduction Activity assuming that Progress Reports are entered into the system as Hazard ReductionActivity. Below is a list of questions and things to be considered when designing a report.</p>
*What are all the data to be included on the report?
*What is the target IMSMA Item item for the Main main report? This is the primary data of your report.*What is the target IMSMA Item item for the sub-reportssubreports? This is the secondary data of your report.*Determine the relationship between the primary data and the secondary data. How did they get reconciled to one another? <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 “Creating a Basic Report” section. Below How are the instructions:</p><ol><ol type="a"><li>Create your main report with the IMSMA item determined as the primary data of your report. This is just a basic report.</li><li>Save your main report</li><li>Compile your main report to make sure that it’s error-free.</li></ol></ol> [[Image:iRepStep02.png|center|500px|''Step 2 – Add Sub-report to the Main report'']]they linked?
====''Step 2 – Add Sub-The main report should be created with the IMSMA item determined to be the Main 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 iReport Template]] section.
<p>Sub-report is reports within a report. As mentioned earlier, a sub-report should be created with ====Step 2 – Add Subreport to the IMSMA Item determined as the secondary data of the report. Below is the instructions to create a sub-Main report:</p>====__NOEDITSECTION__
<ol type="a"><li>Increase the size of Detail section of Once the Main main report has been created you can add a subreport to make room for your sub-the main report.</li> :'''View''' -> '''Bands''' -> '''detail''' -> '''increase The intent of the Band Height''' -> '''Apply''' <li>Click subreport is to bring data from a different but related datasource into the [[Image:iRepBandmain report.png]] button</li><li>Click the detail section of the For example, you could include Activity data on a reportabout Land. Hold down the mouse button and drag Below are the cursor instructions to create a rectangle to define the area of sub-report. Release the botton and the window below displays.</li></ol>subreport:
# On the main report, from the '''Palette''' pane, select '''Subreport''' and drag it to the desired band on the iReport template (normally this is the '''Detail''' band).#:[[Image:IReportSubReportPalette.png|center|300px|''Subreport Palette'']]<div align="center">''Subreport Palette''</div># Release the button and the window below displays.#:[[Image:IReportSubReport1.png|center|500px|''Add Subreport to the Main report'']]# Click '''Next''' to define a new subreport unless you have an existing report that you would like to use for subreport.# Select the desired iReport Template to apply (Blank is recommended).#:[[Image:IReportSubReport2.png|center|500px|''Select the desired iReport Template'']]# Select from the '''Connection/Data Source''' list. This should be the IMSMA item determined as the secondary data of your report. For example, if you are creating a report about Land with Progress Reports, then “Hazard Reduction” should be the data source for the subreport. Click Next.#:[[Image:IReportSubReport3.png|center|500px|''Select the desired datasource'']]# Select the attributes to be included in your subreport. Click '''Next'''.#:[[Image:IReportSubReport4.png|center|500px|''Select the desired fields for the subreport'']]# Select the fields to group by. This step is not required. Click '''Next'''.#:[[Image:iRepBandScreenSubreport_Group_by.png|center|500px|''Select the fields to group by'']]# Enter a name for the subreport or use the default. Choose '''Next'''.#:[[Image:IReportSubReport5.png|center|500px|''Enter a name for the subreport'']] # Select '''Use the same connection used to fill master report'''. Click Finish. #:[[Image:IReportSubReport6.png|center|500px|''Use same connection'']] # The subreport displays.
<ol type="a" start="4"><li>Click '''Next''' ==Step 3 – Add Parameter to define a new sub-report unless you have an existing report that you would like to use for sub-report.</li><li>Select from the '''Connection/Data Source''' list. This should be the IMSMA item determined as the secondary data of your report. For example, if you are creating a report about Hazard with Progress Reports, then “Hazard Reduction” should be the data source for the sub-report. Click Next.</li><li>Select the attributes to be included in your sub-report. Click '''Next'''.</li><li>Select the layout option. Click '''Next'''.</li><li>Enter a name for the sub-report. Click Finish. The sub-report displays.</li></ol>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, [[Image:iRepStep03.pngModify an iReport Template#Adding a Parameter to an iReport Template|center|500px|''Step 3 – Add add a Parameter ]] to Sub-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.
====Step 3 – # From the Report Inspector, '''right click''' on the '''Parameter''' tree and choose '''Add Parameter'''.#: [[Image:IReport AddParameter1.png|center|250px|''Add Parameter '']]# In the '''Properties''' pane, enter a parameter name (e.g. ItemGUID} and edit any other properties. Normally it is not required to edit anything other than the name, you might however want to Sub-report====deselect the '''Use as a prompt''' option.#: [[Image:IReport AddParameter2.png|center|250px|''Add Parameter'']]# Once the parameter is added it will be available in the '''Report Inspector''' and can be referenced as ''$P{parametername}''. For example: $P{ItemGUID}
<p>To connect a sub-report to the Main report, we need to create a parameter ====Step 4 – Define Report Query 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>Subreport====__NOEDITSECTION__
<ol start="The next step is to create a"><li>At report query for the Sub-subreport you just created in Step 2 to define how the IMSMA item on the main report window, select View -> Parametersis related to the IMSMA item on the subreport. :The window displays Typically the subreport report query will receive the guid from the main report via the parameter created in Step 3 and then use it to limit items in the subreport to those linked to the parametersmain report. </ol> Below is the instructions on how to define the report query:
# Open the [[Image:iRep09Modify an iReport Template#Using Report Query filters|report query window]].png|center|500px|# From the report query window, select '''ImsmaQuery'''Figure 9from the query language list. Window of fields, variables, and parameters# Enter a report query filter using the parameter defined above to limit the objects according to the main report object. The most common report query filter would be to filter to only linked objects. For example ''''']]<div alignlinks.toGuid="center$P{ItemGUID}">''Figure 9'''. In this step, the Report Query tells the subreport to return only rows that are linked to the guid of the item in the main report via the link table. Window Other combinations of fields, variables, and parametersreport query filters can be used on subreports beyond the link table. These are documented in the [[#Example Subreport Relationships|Possible Subreport Relationships]] section below.# Click '''OK'''. The report query window closes. </div># Save the subreport.
====Step 5 – Link the Subreport to the Main Report====__NOEDITSECTION__Now that both the main and the subreport are ready, the only thing that remains to be done is linking the two together. Below are the instructions to link the two reports:# 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.# Select the subreport box within the main report.#: [[Image:IReportSubReportSelection.png|center|500px|''Select the Subreport on the main report'']]<ol typediv align="a" start="2center">''Select the Subreport on the main report''<li/div>Click # On the '''Properties''' pane for the Subreport, select the '''NewParameter''' buttonselector.#: [[Image:IReport_SubReportProperties.png|center|200px|''Subreport properties'']]<div align="center">''Subreport properties''</lidiv>:The # '''Add/modify ''' a parameter and type '''exactly the name of the subreport parameter window displayscreated in step 3''' (e.g.''ItemGUID'')#: [[Image:IReport_SubReportParameter.png|center|200px|''Add a parameter'']]<lidiv align="center">From the ''Add/modify a parameter window:''</lidiv>*Enter “# For the '''value expression''object_guid', select the appropriate field to include in the parameter. '''Normally this is '” for the '$F{guid}''Parameter Name''' where but other choices are available.#: [[Image:IReport_SubReportParameter2.png|center|200px|''object_guidSelect the appropriate field'' is ]]<div align="center">''Select the suggested parameter name field to include in the Column D of the Table - Required Parameters for Sub-report below.parameter''</div>*# Click the '''OK''' button. <li>Close the and close Subreport Parameters window that displays the list of all parameters.</li></ol>
[[Image:iRepStep04You are now ready to run your main report. Running (i.e.png|center|500px|''Step 4 – Define Report Query for Sub-previewing) the main report'']]will automatically run the subreport(s) as well, and the data from the main as well as from the subreport(s) will be included in the output.
==Kinds of Subreports==Step 4 – Define Report Query for Sub-report====__NOEDITSECTION__There are three main kinds of relationships in IMSMA on which subreports can be generated from IMSMA data. These are:*Location relationship*Link relationship*Geospatial relationship*Other relationship
<p>The next step is to create a report query for ===Location relationship subreports===__NOEDITSECTION__Because each of the sub-report you just created main items in Step 2 {{IMSMANG}}, Accident, Activity, Assistance, Education, Land, QM, and Victim, must be reconciled to define how a Location during the IMSMA item data entry phase, each of these objects has a relationship with Location and can thus be a subreport on the Main 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 IMSMA item on '''''location guid''''' field. When creating a report where the Sub-main report. Below 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 instructions on how subreport can use a special ImsmaQuery language syntax to limit the subreport data to define those associated with the Report Querymain report's location:</p> location.guid = "$P{parametername}"
<ol start="23"><li>At the Sub-report window, select Data -> Report Query.</li>:The Report query window displays. <li>From location guid field in the Report query window:</li><ol type="a" start="3"><li>Select ImsmaQuery from subreport item table contains the Query language list.</li><li>Enter object.guid = “$P{object_guid}” for of the ImsmaQuery where object location to which the item record is associated. The figure below shows an example of a location and the object type of accident and land that are associated to the IMSMA item on location. Notice that the Main report location_guid value (1234- See Column E 1234) in the Table - Required Parameters for Sub-report below accident and land are identical to determine the ImsmaQuery string for your Sub-reportlocation_guid of the location.</li></ol></ol>
[[Image:iRep10iRep14.png|center|500px|''Figure 10. Define Report Query for Sub-reportlocation_guid example'']]
<div align="center">
''Figure 10. Define Report Query for Sub-reportlocation_guid example''
</div>
<ol>To create a subreport using the Location relationship:<ol type=# From the main "Location"report, pass the location '''''guid''''' to the subreport in a" start="5"><li>Click parameter (e.g. in a parameter called '''OKItemGUID''').</li>:The Report query window closes# Create a parameter on the subreport with the same name as in #1. <li>Click # In the [[Image:iRepCompilesubreport for the related item (e.g.png]] button to compile a Victim) use the parameter in the sub-reportfollowing ImsmaQuery language syntax location.</li></ol></ol>guid="$P{parametername}"
[[Image:iRepStep05.png|center|500px|This has the effect of limiting the subreport records to '''Step 5 – Add Subreport Parameter only those records that are associated to Main Reportthe location'']]' from the main report.
====Step 5 – Add Subreport Parameter to 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(s). 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 Location relationship. The item in the main report is the primary item for which you would like to find linked items. The subreport would return the records for the particular item that is linked to the primary item. The key difference is the query used in the subreport.
<p>We created a parameter on the sub-report to connect to the Main report in Step 3, now we need to To create a parameter on the Main report as well. Below is subreport using the instructions to create the parameter you need for the Main reportlink relationship:</p><ol type="a"><li>Make sure you are at # From the Main main report by selecting the name of the Main report from , pass the '''Window''guid''''' menu or double-clicking of the Main main report from object to the Files pane.</li><li>Double-click the sub-report box within the Main report.</li>:A window displays four tabs subreport in a parameter (Common, Sub-report, Sub-report (Other), and All)e. <li>Select the Sub-report (Other) tabg. Click pass an accident's ''Add'''.</li><li>From the Add/modify parameter window:</li><ol type="i"><li>Enter guid''“$P{object_guid}”'' for the 'in a parameter called ''Sub-report Parameter Name'ItemGUID'' field where ''object_guid'' is ).# Create a parameter on the subreport with the parameter same name you created as in Step 3 #1.# In the subreport for the Sub-reportrelated item (e.g. See Column B a Victim) use the parameter in the Table – Required Parameters for Sub-report below to determine the parameter namefollowing ImsmaQuery language syntax links.</li><li>In the '''Default Value Expression''' field, enter ''toGuid="$FP{guidparametername}''.</li><li>Click '''OK''' and close the windowthe four tabs.</li></ol></ol>"
[[Image:iRepStep06.png|center|500px|This has the effect of limiting the subreport records to only those records that have a '''link'Step 6 – Repeat Step 2-5 for additional sub-reports.'']]to the guid or object passed from the main report.
===Geospatial relationships=Step 6 – Repeat Step 2-5 ==__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 additional sub-reportsany item that has geospatial information associated with it.====To include point/polygon information on an object's main report, follow 3 basic steps:
<p>You can have multiple sub-reports in one Main *Step 1: Create a main report. To add more sub-reports to for an object with geospatial info*Step 2: Create a GeospatialInfo subreport on the Main main report, just repeat Step 2 to Step 5i.e.</p>a report using the GeospatialInfo datasource<p>Once you have all *Step 3: Create a Geopoint subreport on the sub-reports created for your Main GeospatialInfo report, you can compile and run your Main i.e. a report.</p><p>Below is using the table listing typical parameters required for both Main report and Sub-report.</p>Geopoint datasource
<table border="Step 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 : Create a main report is</td>for an object with geospatial info<td>Sub-report parameter on Main report</td><td>Your Sub-report can be…</td><td>Parameter on Sub-* Create a main report</td><td>Report Query defined on Sub-report</td><td>Comments</td></tr><tr><td>Location</td><td>location_guid</td><td>Hazard,Hazard Reduction,Accident,Victim,MRE, orQC</td><td>location_guid</td><td>locationwith an object that has geospatial information (e.guid = "$P{location_guid}"</td><td>Relationship is defined as “New” to a Location during the reconciliationg. </td></tr><tr><td>Hazard, Hazard Reduction,Accident,Victim,MRE, orQC</td><td>object_guid</td><td>Hazard, Hazard Reduction,Accident,Victim,MRE, orQC</td><td>object_guid</td><td>linksLand).toGuid = "$P{ object_guid}"</td><td>Relationship is defined using “Link” during * Ensure that the reconciliation.</td></tr><tr><td>MRE</td><td>mre_guid</td><td>MRE Detail</td><td>mre_guid</td><td>mre.guid = "$P{mre_guid}"</td><td>Relationship '''''geospatialInfos''''' field is defined as “New” added to a MRE during the reconciliationmain report.</td></tr><tr><td>Hazard Reduction</td><td>hazreduc_guid</td><td>Impact survey,Interviewee,Sector, orVegetation removal</td><td>hazreduc_guid</td><td>hazreduc.guid = "$P{hazreduc_guid}"</td><td>Relationship is defined as “New” to a Hazard Reduction 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 Field Report.</td></tr><tr><td>Sector</td><td>sector_guid</td><td>Sample</td><td>sector_guid</td><td>sector.guid=”$P{sector_guid}”</td><td>Relationship persisted automatically when Samples are entered for each Sector at Field Report.</td></tr><tr><td>Victim</td><td>victim_guid</td><td>Received MREs</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 Step 2: Create a GeospatialInfo subreport on the main report* On the main report, add a subreport using the '''GeospatialInfo''' datasource* Pass the '''''geospatialInfos''''' field to the Advance Reports chapter discusses relationships between Items subreport in IMSMA and also provides instructions on how to create a specific report/sub-reportsparameter (e.g. GeospatialInfoList).</p>'''Note:''' instead of passing the '''''$F{guid}''''' field to the parameter, the parameter value should be '''''$F{geospatialInfos}'''''* In the GeospatialInfo subreport use the parameter in the following ImsmaQuery language syntax guid IN $P{parametername}
==Reports Step 3: Create a Geopoint subreport on Items with the GeospatialInfo report* On the Geospatialinfo subreport, add a Direct Relationship==subreport using the '''Geopoint''' datasource<p>The reports discussed so far * Pass the '''''guid''''' field to the subreport in this training module have been based on a single data sourceparameter (e. In this part of g. GeospatialGUID). '''Note:''' Pass the '''''$F{guid}''''' field '''NOT''' the training module, you will learn to create more complex reports that reference multiple data sources'''''$F{geospatialInfos}''''' value. Some items are dependent on * In the existence of another item. This type of relationship is referred to as a direct relationship. For example, an accident, hazard, hazard reduction, MRE, QC, or victim has a direct relationship to Geopoint subreport use the location to which it is associated. The accident, hazard, hazard reduction, MRE, QC, or victim cannot exist unless it is associated with a location. This direct relationship is enforced parameter in IMSMA via the reconciliation process.</p>following ImsmaQuery language syntax geospatialinfoguid IN $P{parametername}
[[Image:iRep11This has the effect of limiting the Geospatial records to only those records whose guid is linked to the geospatialinfo of the main report. This is an example of nested reports, i.png|center|500px|''Figure 11e. Location a main report, a subreport, and item records directly associated with it'']]<div align="center">''Figure 11a sub-subreport. Location and item records directly associated with it''</div>
Direct ===Other subreport relationships also exist when ===__NOEDITSECTION__Certain items in {{IMSMANG}} have subsets of data that are contained within an itemthem. For example, an MRE education may have MRE education details such as the MRE education type, total audience, and percentage of women and men. The MRE details data requires the MRE to exist. Examples of other subreport relationships include:
The following sections will describe the process for creating reports on items that have a direct relationship between them.<center>{| class="wikitable" width="600"|-| align=Country Structure Areas and Associated Locations"center" colspan===Although a location must be associated with a country structure area, the process for creating a report of locations in a country structure area is very similar to a basic report. The location data source contains a field for each country structure area that is defined in your IMSMA database.  To create a report that lists locations within a country structure area: <ol><li>From the '"2" | ''File'Other subreport relationships'' menu, select '''Report Wizard'''.</li>:The iReport Wizard window displays. |-<li>From the ''| width="150pt" | 'Connection/Data Sources''Parent item' list, select ''Location Data Source''.</li><li>Click the '''Next| width="450pt" | ''' button.</li>:The window to select the attributes to include in the report displays. <li>From the Step 2. select fields screen:</li><ol type="a"><li>Select the country structure levelChild item(s) on which you would like to list the associated locations.</li><li>Select the fields that you would like to include in the report.</li><li>Click the '''Next''' button.</li>:A window displays the selected fields. </ol><li>Click the '''Next''' button.</li>:The window group the report data displays. <li>From the Group lists, select the country structure level(s) that you selected in step 4a.</li></ol> {| class="wikitable"
|-
| [[File:Note.jpg Activity | 40px]] || Be sure to select the highest country structure level for Group 1, followed by the next highest country structure level for Group 2, and so on. |}Activity Device
<ol start="7"><li>Click the '''Next''' button.</li>:The window to select a layout displays. <li>From the window to select a layout:</li><ol type="a"><li>Select the layout option for the report.</li><li>Click the '''Next''' button.</li>:The window displays a message stating that you have successfully created a new report.<li>Click the '''Finish''' button.</li>:The template for your report displays. <li>Click the [[Image:iRepCompile.png]] button to compile the report.</li>:The Save report window displays.<li>Enter a name for the report in the '''File name''' field.</li><li>If there are no compilation errors, you may click the [[Image:iRepRun.png]] button to run the report.</li>:The results of the report display in the iReport JasperViewer window. </ol></ol>Impact survey
===Location and Associated Items===A report of locations and associated items requires you to create an iReport sub-report. A sub-report is a report that is contained within another report. A report on locations and its associated item records will require you to create a report and a sub-report. The main report will contain the data for the location. For each associated item that you would like to include, you will need to create a sub-report. Interviewee
[[Image:iRep12.png|center|500px|''Figure 12. Location and associated item records'']]<div align="center">''Figure 12. Location and associated item records''</div>Question
All records in IMSMA have a ''guid''. A ''guid'' is a unique value that identifies the record in the IMSMA database. Because the guid is lengthy and comprised of alphanumeric characters, it is typically not a useful value to display in a report. However, the guid is necessary in determining which item records have a direct relationship. |-| Education || Education details|-| Victim || Received Education
All accidents, hazards, hazard reductions, MREs, QCs, and victims are associated with a single location. The information about the location to which an item record is associated is stored in the location_guid field of the item table and corresponds to the location_guid of the location to which it is associated ([[:Image:iRep03.png|Figure 13]]). Needs Assessment
[[Image:iRep13.png|center|500px|''Figure 13. location_guid'']]<div align="center">''Figure 13. location_guid''</div> The location_guid field in the item table contains the guid of the location to which the item record is associated. [[:Image:iRep14.png|Figure 14]] shows an example of a location and the accident and hazard that are associated to the location. Notice that the location_guid value (1234-1234) in the accident and hazard are identical to the location_guid of the location.Cause [[Image:iRep14.png|center|500px|''Figure 14. location_guid example'']]<div align="center">''Figure 14. location_guid example''</div> Creating a report of a location and associated items will require you to complete the following parts::*Part 1: Create a report with location fields:*Part 2: Create a sub-report for the associated item:*Part 3: Add parameters to the sub-report:*Part 4: Create a query the in sub-report to associate the guid to the location report:*Part 5: Add parameters to the location report:*Part 6: Compile and execute the location report ====Part 1. Create a report with location fields====The first part of creating a report of locations and their associated items is to create a report of the location fields you would like to include. <ol><li>Ensure that the IMSMA server is started.</li><li>From the '''File''' menu, select '''Report Wizard'''.</li><li>From the '''Connection/Data Sources''' list, select Location Data Source to create a report of locations.</li><li>Click the '''Next''' button.</li>:The iReport Wizard, Step 2 window displays a list of the location attributes.<li>Select the fields you would like to include for the location.</li><li>Click the '''Next''' button.</li>:The window displays a list of the attributes that you have selected.<li>Click the '''Next''' button.</li>:The iReport Wizard, Step 3 window displays to allow you to group the report results.<li>Because the report results for this exercise will not need to be grouped, click the Next button.</li>:The iReport Wizard, Step 4 window displays to allow you to select the report layout.<li>Select a layout option.</li><li>Click the '''Next''' button.</li>:The iReport Wizard, Step 5 window displays. <li>Click the '''Finish''' button.</li><li>Save the report by doing one of the following:</li>*Click the [[Image:iRepSave.png]] icon. *From the File menu, select '''Save'''. ::The Save report window displays.<li>Enter a name for the report in the '''File name''' field.</li><li>Click the Save button.</li></ol> ====Part 2. Create a sub-report for the associated item==== <table border="1"><tr><td>The next part of the process for creating a report on locations and its associated items requires you to create a sub-report within the location report.</td></tr></table> <ol><li>Expand the detail section of the report by doing the following:</li><ol type="a"><li>From the '''View''' menu, select '''Bands'''.</li><li>From the left pane, select ''detail''.</li><li>In the '''Band Height''' field that is in the right pane, increase the height of the detail section. At a minimum you will want to double the height.</li></ol></ol> [[Image:iRep15.png|centerLand |500px|''Figure 15. Detail band height'']]<div align="center">''Figure 15. Detail band height''</div> <ol><ol type="a" start="3">Land Device<li>Click the '''Apply''' button.</li><li>The height of the band increases based on the value that you entered.</li></ol></ol> [[Image:iRep16.png|center|500px|''Figure 16. Increased detail band'']]<div align="center">''Figure 16. Increased detail band''</div> <ol start="2"><li>Click the [[Image:iRepBand.png]] button to add a sub-report.</li>:The cursor changes to a crosshair. </ol> [[Image:iRep17.png|centerAccident |500px|''Figure 17. Sub-report button'']]<div align="center">''Figure 17. Sub-report button''</div> <ol start="3">Accident Device<li>Click the detail section of the report.</li><li>While holding down the mouse button, drag the cursor to form the rectangle which will contain the sub-report.</li><li>Release the mouse button.</li>:The window below displays. </ol> [[Image:iRep18.png|center|500px|''Figure 18. Sub-report creation'']]<div align="center">''Figure 18. Sub-report creation''</div> <ol start="6"><li>From the window:</li><ol type="a"><li>Select the ''Create a new report'' option.</li><li>Click the '''Next''' button.</li>::The How fill the sub-report screen displays.</ol><li>From the window:</li><ol type="a"><li>Select the data source for the associated item from the Connection/Data Source list. For example, if you are creating a report of locations and its associated accidents, you would select the accident data source.</li><li>Click the '''Next''' button.</li>::The window to select the attributes to include in the report displays. </ol><li>From the window:</li><ol type="a"><li>Select the attributes that you would like to include in the report.</li><li>Click the Next button.</li>::The window to select a layout displays.</ol><li>From the window to select a layout:</li><ol type="a"><li>Select the layout option.</li><li>Click the Next button.</li>::The window to specify the sub-report expression displays. </ol><li>From the window to specify the sub-report expression:</li><ol type="a"><li>Enter a name for the sub-report.</li><li>Click the Finish button.</li>::The sub-report displays. </ol></ol> ====Part 3. Add parameters to the sub-report==== <table border="1"><tr><td>The next part of the process for creating a report on locations and its associated items is to define parameters that will be used for passing the location id between the sub-report and location report.</td></tr></table> <ol><li>From the '''View''' menu, select '''Parameters'''.</li>:The window displays the parameters. </ol> [[Image:iRep19.png|center|500pxAssistance |''Figure 19. Window of fields, variables, and parameters'']]<div align="center">''Figure 19. Window of fields, variables, and parameters''</div> <ol><li>Click the '''New''' button.</li>:The Add/modify parameter window displays.<li>From the Add/modify parameter window:</li><ol type="a"><li>In the '''Parameter Name''' field, enter a name for the parameter that will be used to identify the guid for the location.</li></ol></ol> {| class="wikitable"Assistance Given
|-
| [[File:Note.jpg Task | 40px]] || Although there are no requirements for the parameter name, you should enter a name that is easy to remember and meaningful (for example, ''location'' or ''location_guid''). Make note of this parameter name since it will used in a later step.Work Item
|}
</center>
<ol start="4"><ol type="The process for creating a" start="2"><li>Click report on a parent item and its children is the '''OK''' button.</li><li>Close the window that displays the list of all parameters.</li></ol><same as any other report/ol> ====Part 4subreport relationship. Create a query in the sub-report to associate the guid to the location report====
===Example Subreport Relationships===__NOEDITSECTION__
{| class="wikitable"
| align="center" style="background:#f0f0f0;"|'''Main Report'''
| align="center" style="background:#f0f0f0;"|'''Subreport can be'''
| align="center" style="background:#f0f0f0;"|'''Value to Pass to Subreport'''
| align="center" style="background:#f0f0f0;"|'''Report Query'''
|-
| Location||Any Item with a Location||location guid||location.guid = "$P{ItemGUID}"
|-
| Any linked item||Any linked Item||Item guid (e.g. Land guid)||links.toGuid="$P{ItemGUID}"
|-
| Activity||Impact survey or Interviewee||Activity guid||hazreduc.guid = "$P{ItemGUID}"
|-
| Interviewee||Question||interviewee guid||interviewee.guid = “$P{ItemGUID}”
|-
| Task||Work Item||Task guid||task.guid = "$P{ItemGUID}"
|-
| Any Item with Geospatial information||GeospatialInfo||geoSpatialInfos||guid IN $P{GeospatialInfoList}
|-
| Geospatial Info||GeoPoint||GeospatialInfo guid||geospatialInfoGuid = "$P{ItemGUID}"
|-
| Any item with devices||Item Device (e.g. AccidentDevice)||Item guid (e.g. Accident guid)||accident.guid = "$P{ItemGUID}" hazard.guid = "$P{ItemGUID}"
|-
| MRE||MREDetail||MRE guid||mre.guid = "$P{ItemGUID}"
|-
| [[File:Note.jpg Victim||Needs Assessment| 40px]] |victim guid| The next part of the process for creating a report on locations and its associated items is to create a query that defines how the location and associated item are related in the IMSMA database. |} <ol><li>From the '''Data''' menu, select '''Report Query'''victim.</li>:The Report query window displays. <li>From the Report query window:</li><ol typeguid="a$P{ItemGUID}"><li>Select ''ImsmaQuery'' from the '''Query language''' list.</li>|-<li>In the field below the Query language list, enter location| Victim||Cause||victim guid||victim.guid = "$P{''ParameterName''ItemGUID}"</li>where ''ParameterName'' is the name of the parameter that you created for the location guid.|-</ol></ol> [[Image:iRep20.png|centerAssistance||Assistance Given|500px|''Figure 20victimAssistance. Query for report on locations and associated items'']]<div align="center">''Figure 20guid||victimAssistance. Query for report on locations and associated items''</div> <ol startguid="3"><ol type="a" start="3"><li>Click the '''OK''' button.</li>:The Report query window closes. </ol><li>Click the [[Image:iRepCompile.png]] button to compile the sub-report.</li></ol> ====Part 5. Add parameters to the location sub-report==== $P{| class="wikitableItemGUID}"
|-
| [[File:Note.jpg Task| 40px]] |Objective| The next part |SQL Field list of the process for creating a report on locations and its associated items is to update the location report to include the parameter that will be used to associate the location record to item records. Objectives||guid IN ($P{SQLList<ol><li>Display the location report by doing one of the following:</li>*From the '''Window''' menu, select the name of the location report. *Close the sub-report. *Bring the location report to the foreground by double-clicking the location report name that is displayed in the Files pane. <li>Double-click the sub-report box within the report.</li>:A window displays four tabs (Common, Sub-report, Sub-report (Other), and All). <li>From the window:</li><ol type="a"><li>Select the Sub-report (Other) tab.</li><li>Click the '''Add''' button.</li>:The Add/modify parameter window displays. </ol><li>From the Add/modify parameter window:</li><ol type="a"><li>In the '''Sub-report Parameter Name''' field, enter the parameter name that you used for the location.</li></ol></ol> {| class="wikitable"
|-
| [[File:Note.jpg Work Item| 40px]] |Linked Items (Activity, Education, QM, Assistance)| This is the parameter that you created previously. |SQL Field list of Items||guid IN ($P{SQLList})
|}
 <ol start="5"><ol type="a" start="2"><li>In the '''Default Value Expression''' field, enter ''$F{guid{NavBox HowTo Standardizing Data Analysis and Information Reporting}}''.</li><li>Click the '''OK''' button.</li></ol><li>Close the window with the four tabs.</li></ol> ====Part 6. Compile and execute the location report==== <ol><li>Ensure that the ''Location'' data source is selected from the list.</li><li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><li>Click the [[ImageCategory:iRepRun.pngNAA]] button to execute the report.</li>:The report results displays. </ol>
6,632
edits

Navigation menu