Difference between revisions of "Create a Basic iReport Template"
Line 1: | Line 1: | ||
==Report Basics== | ==Report Basics== | ||
− | ===Creating a Basic Report=== | + | ===Creating a Basic Report===__NOEDITSECTION__ |
Basic reports are reports that are generated against a single type of item. You may create a report of the following items: | Basic reports are reports that are generated against a single type of item. You may create a report of the following items: | ||
*Accident | *Accident | ||
Line 126: | Line 126: | ||
</ol> | </ol> | ||
− | ===Grouping=== | + | ===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>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> | <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> | ||
Line 142: | Line 142: | ||
</div> | </div> | ||
− | ====Adding a Group to an Existing Report==== | + | ====Adding a Group to an Existing Report====__NOEDITSECTION__ |
{{note|The field on which you would like to group your report results must be included in the report.}} | {{note|The field on which you would like to group your report results must be included in the report.}} | ||
Line 167: | Line 167: | ||
{{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''}.}} | {{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''}.}} | ||
− | ===Adding Fields=== | + | ===Adding Fields===__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> | <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> | ||
<p>To add a field to your report:</p> | <p>To add a field to your report:</p> | ||
Line 189: | Line 189: | ||
</ol> | </ol> | ||
− | ===Sorting Report Results=== | + | ===Sorting Report Results===__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. | 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. | ||
To sort report results: | To sort report results: |
Revision as of 11:23, 8 July 2013
Contents
Report Basics
Creating a Basic Report
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
The sample report Summary_Location .jrxml in the <iReport Installation Directory>\iReports_IMSMA\IMSMA reports directory provides an example of a basic report. |
To create a report:
- From the File menu, select Report Wizard.
- The iReport Wizard window displays.
- From the Connection/Data Sources list, select the item for which you would like to create a report.
Figure 1. iReport Wizard – Step 1
- Click the Next button.
- The window to select the attributes to include in the report displays.
Figure 2. iReport Wizard - Step 2
- From the Step 2. select fields screen:
- Select the attributes that you would like to include in the report. Error! Reference source not found. describes the available buttons.
- Click the Next button.
- A window displays the selected fields.
- Click the Next button.
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. Figure 3 illustrates an example of a report that groups its results by gazetteer. For more information on grouping, refer to Grouping.
- 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.
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. |
- Click the Next button.
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.
Figure 4. Columnar layout
The tabular layout option displays the field names across the top of the page. The corresponding report results are displayed below each field name.
Figure 5. Tabular layout
- From the window to select a layout:
- Select the layout option.
- Click the Next button.
- The window displays a message stating that you have successfully created a new report.
- Click the Finish button.
- The template for your report displays.
- Ensure that the data source selected matches the item of the report.
Figure 6. Report data source
- Click the File:IRepCompile.png button to compile the report.
- The Save report window displays.
- Enter a name for the report in the File name field.
- If there are no compilation errors, click the File:IRepRun.png button to run the report.
- The results of the report display in the iReport JasperViewer window.
Grouping
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.
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 (Figure 7).
Figure 7. Land report with no grouping
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.
Figure 8. Lands grouped by location
Adding a Group to an Existing Report
The field on which you would like to group your report results must be included in the report. |
To add a group to an existing report:
- From the View menu, select Report Groups.
- A window displays the groups for the report.
- Click the New button.
- The Add/modify group window displays.
- 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.
- Click the File:IRepExpress.png icon.
- The Expression editor window displays.
- Ensure that the Objects and expressions tab is selected.
- Click Fields.
- Double-click the name of the field on which you would like to add a grouping.
- The Expression editor window shows $F{FieldName} where FieldName is the name of the field that you selected previously.
- Click the Apply button.
- The Add/modify group window displays the expression in the Group Expression field.
- Click the OK button.
- The Add/modify group window closes.
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}. |
Adding Fields
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.
To add a field to your report:
- From the View menu, select the Fields option.
- A window displays three tabs (Fields, Variables, and Parameters).
- From the Fields tab, click the New button.
- The Add/modify field window displays.
- In the Field Name field, enter the name of the field that you would like to include.
- Click the OK button.
- The field is included on the Fields tab.
- Close the window that displays the Fields, Variables, and Parameters tabs.
- Reposition the fields on your report as needed to accommodate the new field.
- Click the File:IRepF.png icon.
- Click the detail section of the report.
- While holding down the mouse button, drag the cursor to form the rectangle which will contain the new field.
- Release the mouse button.
- A placeholder for the field is displayed in the design section of the report.
- Double-click the placeholder that was added for the field.
- Change the placeholder text so that the field that you added is between the brackets.
Sorting Report Results
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. To sort report results:
- Create the report.
- From the Data menu, select the Report Query option.
- The Report query window displays.
- Click the Sort options button that is located at the bottom of the Report query window.
- The Sorting Options window displays.
- Click the Add Field button.
- The Sort Field window displays. The Sort by list displays all the fields that you have selected for the report.
- From the Sort by list, select the field by which you would like to sort the report results.
When sorting data in reports that contain groups, ensure the “Group by” fields appear first in the sort order. |
- From the Sort Type list, select either the Ascending or Descending sort order.
- Click the OK button.
- The selected field displays in the Sorting Options window.
- Repeat steps 4-7 for each field on which you would like to sort the results.
- After you have completed adding the fields on which you would like to sort the results, click the Close button.
- The Sorting Options window closes.
- From the Report query window, click the OK button.
- The Report query window closes.
You will need to compile and execute the report for the sort options to take effect.