518
edits
Changes
Version 6.0
}}
==Overview==__NOEDITSECTION__
Once an iReport template has been created, there are many options for modifying the report template including adding new fields, creating variables, filtering the query results and many other options. This section covers the main customisations performed on iReport templates for use in {{IMSMANG}}.
==Fields, Variables, and Parameters==__NOEDITSECTION__
===Adding a Field to an iReport Template===__NOEDITSECTION__
<p>If you need to include a field that was not selected while using the Report Wizard, there are several options for including additional fields. The definition of a field
====Option 1: Get fields from Datasource====__NOEDITSECTION__
## Select the variable class (i.e. the type of variable to be created. Normally this is the same as the type of the field to be used).
## Choose the '''Calculation''' type, normally '''Sum''' or '''Count'''
## Enter a '''Variable Expression'''. Normally this is simply selecting the field to be summed or counted (e.g. '''$F{areaSize}'''). Click the [[Image:Editor Button.png]] on the Variable Expression line to open the Variable Expression editor.
#: [[Image:IReport VariableAdd5.png|center|300px|''Edit Variable Expression'']]<div align="center">''Edit Variable Expression''</div>
# Choose OK
==Report Query Filtering==__NOEDITSECTION__
iReport Designer provides an option for limiting or filtering the results of the query that returns data to the report. While in most cases this Report Query filter is ignored by {{IMSMANG}} once the report as has been imported in favor of the search criteria, there are some cases where it is important to edit the Report Query filters in iReport. The two main reasons are:
* '''temporarily''': to limit the results returned when previewing the report during the design phase in iReport
* '''permanently''': for use in Subreports to restrict the data returned to those that have a relationship with the main report. For example to only return Activities that are associated with the Land in the main report.
# Choose '''ImsmaQuery''' from the '''Query Language''' drop down.
#:[[Image:IReport ReportQuery.png |center|400px|''iReport Report Query Window'']]<div align="center">''Report Query Window''</div>
# Enter a valid [[#ImsmaQuery Language Syntax|ImsmaQuery Language]] filter in the textbox (e.g. localId='"MF-HQ-1'")
# Choose the '''Preview Data''' button to verify that the query is limited as desired.
# Choose '''OK''' to save the Report Query settings and return to the report.
localId = "MF-HQ-1"
#To start using ImsmaQuery Language, first decide which field you want to include in your filter. You may choose any field that is available on the data source to begin your filtering. As in most places in iReport fields are case sensitive. Therefore '''''localId''''' will work but '''''LocalId''''', '''''LocalID''''' and '''''localid''''' will all fail to filter the data.}}
#Next choose your operator. Valid operators include "=", "<", ">", "<>", and "LIKE" among others.
#Finally, select the value you want to use. Values in ImsmaQuery are always double quoted (e.g. "MF-HQ-1" or "MF-HQ-%"). In addition to constants in the value section, the LIKE operator can take % characters to represent wild cards. For example:
MRESQLField
These fields can be added during the [[Create a Basic i-Report Template|iReport Wizard]] process or manually added later. To use the SQL field
To use the SQL field to select data from the IMSMA database:
:The Sorting Options window displays.
<li>Click the '''Add Field''' button.</li>
<li>From the '''Sort by''' list, select the field by which you would like to sort the report results.</li>
</ol>
<li>From the '''Sort Type''' list, select either the ''Ascending'' or ''Descending'' sort order.</li>
<li>Click the '''OK''' button.</li>
::The Sorting window displays. The Sort by list displays all the fields that you have selected field displays in for the Sorting Options windowreport.
<li>Repeat steps 4-7 for each field on which you would like to sort the results.</li>
<li>After you have completed adding the fields on which you would like to sort the results, click the '''Close''' button.</li>