Difference between revisions of "Create a Basic iReport Template"

From IMSMA Wiki
Jump to: navigation, search
 
(43 intermediate revisions by 6 users not shown)
Line 1: Line 1:
==Report Basics==
+
__FORCETOC__
===Creating a Basic Report===__NOEDITSECTION__
+
{{TOC right}}
Basic reports are reports that are generated against a single type of item. You may create a report of the following items:
 
*Accident
 
*Data Entry Form
 
*Land
 
*Activity
 
*Location
 
*Education
 
*Organisation
 
*Place
 
*QM
 
*Victim
 
*Task
 
*Work Item
 
  
{{note|The sample report ''Summary_Location .jrxml'' in the <''iReport Installation Directory''>\iReports_IMSMA\IMSMA reports directory provides an example of a basic report.}}
+
==Creating a Basic iReport Template Using the Wizard==__NOEDITSECTION__
 +
There is a wizard in iReport to help in the process of creating new iReport templates. To create an iReport template using the Wizard:
  
To create a report:
 
 
<ol>
 
<ol>
<li>From the '''File''' menu, select '''Report Wizard'''. </li>
+
<li>In the '''File''' menu &rarr; '''New...'''. </li>
:The iReport Wizard window displays.
+
<li>Select the template you would like to use for your report. Blank A4 or an IMSMA specific template are preferrable</li>
<li>From the '''Connection/Data Sources''' list, select the item for which you would like to create a report.</li>
 
 
</ol>
 
</ol>
 
+
{{note|At iReport startup, it can take several seconds to load the window with the templates. The next time you click on '''New...''' however, the templates appear instantaneously.}}
[[Image:iRep01.png|center|500px|''Figure 1. iReport Wizard – Step 1'']]
 
 
<div align="center">
 
<div align="center">
''Figure 1. iReport Wizard – Step 1''
+
[[Image:iReport Wizard1.png|center|500px|''iReport Wizard – Step 1'']]
 +
''iReport Wizard – Step 1''
 
</div>
 
</div>
  
 
<ol start="3">
 
<ol start="3">
<li>Click the '''Next''' button.</li>
+
<li>Click the '''Launch Report Wizard''' button.</li>
:The window to select the attributes to include in the report displays.
 
 
</ol>
 
</ol>
  
[[Image:iRep02.png|center|500px|''Figure 2. iReport Wizard - Step 2'']]
+
<div align="center">
<div>
+
[[Image:iReport Wizard2.png|center|500px|''iReport Wizard - Step 2'']]
''Figure 2. iReport Wizard - Step 2''
+
''iReport Wizard - Step 2''
 
</div>
 
</div>
  
 
<ol start="4">
 
<ol start="4">
<li>From the Step 2. select fields screen:</li>
+
<li>Select the desired Data Source for the report and choose '''Next'''</li>
<ol type="a">
 
<li>Select the attributes that you would like to include in the report. '''Error! Reference source not found.''' describes the available buttons.</li>
 
 
</ol>
 
</ol>
 +
<div align="center">
 +
[[Image:iReport Wizard3.png|center|500px|''iReport Wizard - Step 3'']]
 +
''iReport Wizard - Step 3''
 +
</div>
 +
 +
<ol start="5">
 +
<li>Select the desired data fields for the report and choose '''Next'''</li>
 
</ol>
 
</ol>
 +
<div align="center">
 +
[[Image:iReport Wizard4.png|center|500px|''iReport Wizard - Step 4'']]
 +
''iReport Wizard - Step 4''
 +
 +
  
<center>
 
 
{| class="wikitable" width="500"
 
{| class="wikitable" width="500"
 
|-
 
|-
| align="center" colspan="2" | '''Table 2. iReport Wizard – Buttons for selecting fields'''
+
| align="center" colspan="2" | '''iReport Wizard – Buttons for selecting fields'''
 
|-
 
|-
 
| width="125pt" | '''Button'''
 
| width="125pt" | '''Button'''
Line 58: Line 52:
 
| align="center" | [[Image:iRepDRA.png]] || Includes data for all fields in the report.
 
| align="center" | [[Image:iRepDRA.png]] || Includes data for all fields in the report.
 
|-
 
|-
| align="center" | [[Image:iRepLA.png]] || Removes the selected field from the report.
+
| align="center" | [[Image:iRepLA.png]] || Deletes the selected field from the report.
 
|-
 
|-
| align="center" | [[Image:iRepDLA.png]] || Indicates a tip for using IMSMA.
+
| align="center" | [[Image:iRepDLA.png]] || Deletes all fields from the report.
 
|}
 
|}
</center>
+
</div>
 
 
{{note|If you would like to organise the report results by country structure areas, you should include the country structure level by which you would like to group the results as one of the fields. Be aware that including the country structure level field in the report will return a string that contains all country structure levels above the selected level.}}
 
 
 
<ol start="5">
 
<ol type="a" start="2">
 
<li>Click the '''Next''' button.</li>
 
:A window displays the selected fields.
 
</ol>
 
 
 
<li>Click the '''Next''' button.</li>
 
The window to group the report data displays. The group by step allows you to list item records that have the same value for the selected group by field together in the report. [[:Image:iRep03.png|Figure 3]] illustrates an example of a report that groups its results by gazetteer. For more information on grouping, refer to Grouping.
 
</ol>
 
  
[[Image:iRep03.png|center|500px|''Figure 3. Group by example'']]
+
{{note|It is recommended to always include the ''guid'' field when designing a report}}
  
 
<ol start="6">
 
<ol start="6">
<li>If you would like to group the report data, select the attribute on which you would like to group the data from the Group list.</li>
+
<li>Click the '''Next''' button.
 +
The [[Modify an iReport Template#Sorting_and_Grouping|group by]] step allows you to list item records that have the same value for the selected group by field together in the report. If you would like to group the report data, select the attribute on which you would like to group the data from the Group list.</li>
 
</ol>
 
</ol>
 
{{note|If you choose to group the report data, you may also want to sort the data using the attribute. For more information on sorting, refer to Sorting.}}
 
 
<ol start="7">
 
<li>Click the '''Next''' button.</li>
 
The window to select a layout displays. The iReport wizard provides two layout options. The Columnar layout option displays the field names in one column and their corresponding report result in another column.
 
</ol>
 
 
[[Image:iRep04.png|center|500px|''Figure 4. Columnar layout'']]
 
 
<div align="center">
 
<div align="center">
''Figure 4. Columnar layout''
+
[[Image:iReport Wizard5.png|center|500px|''iReport Wizard - Step 5'']]
</div>
 
 
 
<p>The tabular layout option displays the field names across the top of the page. The corresponding report results are displayed below each field name.</p>
 
  
[[Image:iRep05.png|center|500px|''Figure 5. Tabular layout'']]
+
''iReport Wizard - Step 5''
<div align="center">
 
''Figure 5. Tabular layout''
 
 
</div>
 
</div>
 
 
<ol start="7">
 
<ol start="7">
<li>From the window to select a layout:</li>
+
<li>Click the '''Next''' button and then '''Finish'''</li>
<ol type="a">
+
The Wizard is complete and the iReport template designer window is open. Depending on your selections your template will look different from the example below.
<li>Select the layout option.</li>
 
<li>Click the '''Next''' button.</li>
 
:The window displays a message stating that you have successfully created a new report.
 
</ol>
 
<li>Click the '''Finish''' button.</li>
 
:The template for your report displays.
 
<li>Ensure that the data source selected matches the item of the report.</li>
 
 
</ol>
 
</ol>
  
[[Image:iRep06.png|center|500px|''Figure 6. Report data source'']]
 
<div align="center">
 
''Figure 6. Report data source''
 
</div>
 
 
<ol start="11">
 
<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, click the [[Image:iRepRun.png]] button to run the report.</li>
 
:The results of the report display in the iReport JasperViewer window.
 
</ol>
 
 
===Grouping===__NOEDITSECTION__
 
<p>Grouping allows you to organise the report results using the values of a particular field. Grouping results makes it easier to identify the records which share a common value. Rather than having to visually scan the report results to determine which records have a common value, grouping automatically organises the results for you.</p>
 
<p>To illustrate, suppose you wanted to create a report to list all lands within each location ID. The procedures that have been discussed so far in this training module would simply list all lands along with their location ID. Although the location ID is included in the report, it would be difficult, tedious, and time-consuming to scan the entire report to identify those lands that have a common location ID ([[:Image:iRep07.png|'''Figure 7''']]).</p>
 
 
[[Image:iRep07.png|center|500px|''Figure 7. Land report with no grouping'']]
 
<div align="center">
 
''Figure 7. Land report with no grouping''
 
</div>
 
 
<p>Grouping report results automatically organises the records using the values on the specified field. Using the example above, the lands in the report shown in Figure 8 are organised within the location to which they are associated. Records that do not contain a value for the selected grouping are put into their own group.</p>
 
  
[[Image:iRep08.png|center|500px|''Figure 8. Lands grouped by location'']]
 
 
<div align="center">
 
<div align="center">
''Figure 8. Lands grouped by location''
+
[[Image:iReportHome1.png|center|500px|''iReport Wizard - Final Step'']]
 +
''iReport Wizard - Final Step''
 
</div>
 
</div>
  
====Adding a Group to an Existing Report====__NOEDITSECTION__
+
==iReport Designer Orientation==__NOEDITSECTION__
 +
Once your initial iReport template has been created you can begin adding data elements to the template, modifying the layout and formatting, and other aspects of [[Modify an iReport Template|modifying an iReport Template]]. Below is a brief orientation to the panes and functions available in the iReport Designer. If any of the panes or windows are unavailable they can be added back by selecting the relevant item from the '''Window''' menu.
  
{{note|The field on which you would like to group your report results must be included in the report.}}
+
===Report Inspector === __NOEDITSECTION__
 +
The Report Inspector pane displays a hierarchical structure of the iReport template and provides access to the available fields, parameters, and variables as well as all formatting elements of the report. Each node can be expanded for more details about the elements contained in it.
  
To add a group to an existing report:
+
===Report Canvas ===__NOEDITSECTION__
<ol>
+
The middle area of the iReport Designer displays a graphical representation of the iReport template that corresponds to the hierarchical structure in the Report Inspector. In this pane you move elements around on the canvas as well as select individual elements for editing.
<li>From the '''View''' menu, select '''Report Groups'''.</li>
 
<li>A window displays the groups for the report.</li>
 
<li>Click the '''New''' button.</li>
 
:The Add/modify group window displays.
 
<li>Enter an identifier for the group. This should be a meaningful name that allows you to easily identify the contents of the group such as the field on which the results are grouped.</li>
 
<li>Click the [[Image:iRepExpress.png]] icon.</li>
 
:The Expression editor window displays.
 
<li>Ensure that the Objects and expressions tab is selected.</li>
 
<li>Click '''Fields'''.</li>
 
<li>Double-click the name of the field on which you would like to add a grouping.</li>
 
:The Expression editor window shows $F{FieldName} where FieldName is the name of the field that you selected previously.
 
<li>Click the '''Apply''' button.</li>
 
:The Add/modify group window displays the expression in the Group Expression field.  
 
<li>Click the '''OK''' button.</li>
 
:The Add/modify group window closes.
 
</ol>
 
  
{{note|You may also enter the expression in the Group Expression field if you know the exact spelling of the field name on which you would like to group the results. The syntax is $F{''FieldName''}.}}
+
===Properties Pane ===__NOEDITSECTION__
 +
This pane will display all of the properties of items selected in the Report Inspector or Report Canvas. The Properties Pane displays a context-senstive list of properties for any selected item for editing.
  
===Adding Fields===__NOEDITSECTION__
+
===Palette===__NOEDITSECTION__
<p>If you need to include a field that was not selected while using the Report Wizard, you will need to know the name of the field that is used by the data source. Find a list of available field names by using the Report Wizard.</p>
+
The Palette is the area where individual graphic elements can be selected and dragged onto the canvas. This includes subreports and crosstab elements.
<p>To add a field to your report:</p>
 
<ol>
 
<li>From the '''View''' menu, select the '''Fields''' option.</li>
 
:A window displays three tabs (Fields, Variables, and Parameters).
 
<li>From the Fields tab, click the '''New''' button.</li>
 
:The Add/modify field window displays.
 
<li>In the '''Field Name''' field, enter the name of the field that you would like to include.</li>
 
<li>Click the '''OK''' button.</li>
 
:The field is included on the Fields tab.
 
<li>Close the window that displays the Fields, Variables, and Parameters tabs.</li>
 
<li>Reposition the fields on your report as needed to accommodate the new field.</li>
 
<li>Click the [[Image:iRepF.png]] icon.</li>
 
<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 new field.</li>
 
<li>Release the mouse button.</li>
 
:A placeholder for the field is displayed in the design section of the report.  
 
<li>Double-click the placeholder that was added for the field.</li>
 
<li>Change the placeholder text so that the field that you added is between the brackets.</li>
 
</ol>
 
  
===Sorting Report Results===__NOEDITSECTION__
+
===Formatting Tools ===__NOEDITSECTION__
It may be helpful to sort the report results using the value in one or more of the fields. Sorting the results makes it easier to review the results and locate any records that you may be searching for.
+
The Formatting Tools pane provides access to various formatting functions designed to manage the size and space between elements on the report.
To sort report results:
 
<ol start="13">
 
<li>Create the report.</li>
 
<li>From the '''Data''' menu, select the '''Report Query''' option.</li>
 
:The Report query window displays.
 
<li>Click the '''Sort options''' button that is located at the bottom of the Report query window.</li>
 
:The Sorting Options window displays.
 
<li>Click the '''Add Field''' button.</li>
 
:The Sort Field window displays. The Sort by list displays all the fields that you have selected for the report.
 
<li>From the '''Sort by''' list, select the field by which you would like to sort the report results.</li>
 
</ol>
 
  
{{note|When sorting data in reports that contain groups, ensure the “Group by” fields appear first in the sort order.}}
+
===iReport Output ===__NOEDITSECTION__
 +
This pane displays any problems or output from the reports.
  
<ol start="18">
+
==XML and Preview Views==__NOEDITSECTION__
<li>From the '''Sort Type''' list, select either the ''Ascending'' or ''Descending'' sort order.</li>
+
In addition to the Designer View, iReport Designer provides 2 additional views, the XML View and the Preview. Using the XML View you can get an editable version of the .jrxml file created by iReport Designer. This is useful for troubleshooting specific problems with a report but is generally only for advanced users.
<li>Click the '''OK''' button.</li>
+
<div align="center">
:The selected field displays in the Sorting Options window.
+
[[Image:iReportXMLView.png|center|500px|''XML View'']]
<li>Repeat steps 4-7 for each field on which you would like to sort the results.</li>
+
''XML View''
<li>After you have completed adding the fields on which you would like to sort the results, click the '''Close''' button.</li>
+
</div>.
:The Sorting Options window closes.
 
<li>From the Report query window, click the '''OK''' button.</li>
 
:The Report query window closes.
 
</ol>
 
 
 
<p>You will need to compile and execute the report for the sort options to take effect.</p>
 
  
 +
The Preview view runs the current version of the iReport template and generates an output file with the results of the report. This is useful for ensuring that the report is functioning as desired prior to importing into {{IMSMANG}}. This is the primary method for running iReport templates within the iReport Designer.
 +
<div align="center">
 +
[[Image:IReportPreview.png|center|500px|''Preview View'']]
 +
''Preview View''
 +
</div>.
  
{{NavBox HowTo use iReport}}
+
{{NavBox HowTo Standardizing Data Analysis and Information Reporting}}
 +
[[Category:NAA]]

Latest revision as of 20:32, 20 February 2020

Creating a Basic iReport Template Using the Wizard

There is a wizard in iReport to help in the process of creating new iReport templates. To create an iReport template using the Wizard:

  1. In the File menu → New....
  2. Select the template you would like to use for your report. Blank A4 or an IMSMA specific template are preferrable
Note.jpg At iReport startup, it can take several seconds to load the window with the templates. The next time you click on New... however, the templates appear instantaneously.
iReport Wizard – Step 1

iReport Wizard – Step 1

  1. Click the Launch Report Wizard button.
iReport Wizard - Step 2

iReport Wizard - Step 2

  1. Select the desired Data Source for the report and choose Next
iReport Wizard - Step 3

iReport Wizard - Step 3

  1. Select the desired data fields for the report and choose Next
iReport Wizard - Step 4

iReport Wizard - Step 4


iReport Wizard – Buttons for selecting fields
Button Description
IRepRA.png Includes the selected field in the report.
IRepDRA.png Includes data for all fields in the report.
IRepLA.png Deletes the selected field from the report.
IRepDLA.png Deletes all fields from the report.
Note.jpg It is recommended to always include the guid field when designing a report
  1. Click the Next button. The group by step allows you to list item records that have the same value for the selected group by field together in the report. If you would like to group the report data, select the attribute on which you would like to group the data from the Group list.
iReport Wizard - Step 5

iReport Wizard - Step 5

  1. Click the Next button and then Finish
  2. The Wizard is complete and the iReport template designer window is open. Depending on your selections your template will look different from the example below.


iReport Wizard - Final Step

iReport Wizard - Final Step

iReport Designer Orientation

Once your initial iReport template has been created you can begin adding data elements to the template, modifying the layout and formatting, and other aspects of modifying an iReport Template. Below is a brief orientation to the panes and functions available in the iReport Designer. If any of the panes or windows are unavailable they can be added back by selecting the relevant item from the Window menu.

Report Inspector

The Report Inspector pane displays a hierarchical structure of the iReport template and provides access to the available fields, parameters, and variables as well as all formatting elements of the report. Each node can be expanded for more details about the elements contained in it.

Report Canvas

The middle area of the iReport Designer displays a graphical representation of the iReport template that corresponds to the hierarchical structure in the Report Inspector. In this pane you move elements around on the canvas as well as select individual elements for editing.

Properties Pane

This pane will display all of the properties of items selected in the Report Inspector or Report Canvas. The Properties Pane displays a context-senstive list of properties for any selected item for editing.

Palette

The Palette is the area where individual graphic elements can be selected and dragged onto the canvas. This includes subreports and crosstab elements.

Formatting Tools

The Formatting Tools pane provides access to various formatting functions designed to manage the size and space between elements on the report.

iReport Output

This pane displays any problems or output from the reports.

XML and Preview Views

In addition to the Designer View, iReport Designer provides 2 additional views, the XML View and the Preview. Using the XML View you can get an editable version of the .jrxml file created by iReport Designer. This is useful for troubleshooting specific problems with a report but is generally only for advanced users.

XML View

XML View

.

The Preview view runs the current version of the iReport template and generates an output file with the results of the report. This is useful for ensuring that the report is functioning as desired prior to importing into IMSMANG. This is the primary method for running iReport templates within the iReport Designer.

Preview View

Preview View

.