http://mwiki.gichd.org:8090/mediawiki/api.php?action=feedcontributions&user=Noah&feedformat=atomIMSMA Wiki - User contributions [en]2024-03-29T06:11:21ZUser contributionsMediaWiki 1.28.0http://mwiki.gichd.org:8090/mediawiki/index.php?title=Create_a_Basic_iReport_Template&diff=11557Create a Basic iReport Template2013-09-23T19:30:11Z<p>Noah: </p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure iReport]]<br />
|[[Use i-Report|Use iReport]]<br />
|[[Create a Basic i-Report Template|Create a Basic iReport Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create iReport Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize iReport Template Data]]<br />
}}<br />
<br />
==Creating a Basic iReport Template Using the Wizard==__NOEDITSECTION__<br />
{{IMSMANG}} provides an iReport Wizard to help in the process of creating new iReport templates. To create an iReport template using the Wizard:<br />
<br />
<ol><br />
<li>From the '''File''' menu, select '''New...'''. </li><br />
:The iReport Wizard window displays. <br />
<li>From the '''Report Templates''' list, select the template you would like to use for your report. Blank A4 or an IMSMA specific template are preferrable</li><br />
</ol><br />
<br />
<div align="center"><br />
[[Image:iReport Wizard1.png|center|500px|''Figure 1. iReport Wizard – Step 1'']]<br />
''Figure 1. iReport Wizard – Step 1''<br />
</div><br />
<br />
<ol start="3"><br />
<li>Click the '''Launch Report Wizard''' button.</li><br />
:The window to name the report and file location displays.<br />
</ol><br />
<br />
<div align="center"><br />
[[Image:iReport Wizard2.png|center|500px|''Figure 2. iReport Wizard - Step 2'']]<br />
''Figure 2. iReport Wizard - Step 2''<br />
</div><br />
<br />
<ol start="4"><br />
<li>Select the desired Data Source for the report and choose '''Next'''</li><br />
</ol><br />
<div align="center"><br />
[[Image:iReport Wizard3.png|center|500px|''Figure 2. iReport Wizard - Step 3'']]<br />
''Figure 3. iReport Wizard - Step 3''<br />
</div><br />
<br />
<ol start="5"><br />
<li>Select the desired data fields for the report and choose '''Next'''</li><br />
</ol><br />
<div align="center"><br />
[[Image:iReport Wizard4.png|center|500px|''Figure 2. iReport Wizard - Step 4'']]<br />
''Figure 4. iReport Wizard - Step 4''<br />
<br />
<br />
<br />
{| class="wikitable" width="500"<br />
|-<br />
| align="center" colspan="2" | '''Table 2. iReport Wizard – Buttons for selecting fields'''<br />
|-<br />
| width="125pt" | '''Button'''<br />
| width="375pt" | '''Description'''<br />
|-<br />
| align="center" | [[Image:iRepRA.png]] || Includes the selected field in the report.<br />
|-<br />
| align="center" | [[Image:iRepDRA.png]] || Includes data for all fields in the report.<br />
|-<br />
| align="center" | [[Image:iRepLA.png]] || Removes the selected field from the report.<br />
|-<br />
| align="center" | [[Image:iRepDLA.png]] || Indicates all fields from the report.<br />
|}<br />
</div><br />
<br />
{{note|It is recommended to always include the ''guid'' field when designing a report}}<br />
<br />
<ol start="6"><br />
<li>Click the '''Next''':<br />
The window to group the report data displays. 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><br />
</ol><br />
<div align="center"><br />
[[Image:iReport Wizard5.png|center|500px|''Figure 5. iReport Wizard - Step 5'']]<br />
<br />
''Figure 5. iReport Wizard - Step 5''<br />
</div><br />
<ol start="7"><br />
<li>Click the '''Next''' button and then '''Finish'''</li><br />
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.<br />
</ol><br />
<br />
<br />
<div align="center"><br />
[[Image:iReportHome1.png|center|500px|''Figure 2. iReport Wizard - Final Step'']]<br />
''Figure 6. iReport Wizard - Final Step''<br />
</div><br />
<br />
==iReport Designer Orientation==__NOEDITSECTION__<br />
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 '''Window''' menu.<br />
<div align="center"><br />
[[Image:IReportPanes2.png|center|500px|''iReport Panes'']]<br />
''iReport Panes''<br />
</div><br />
<br />
===Report Inspector === __NOEDITSECTION__<br />
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.<br />
<br />
===Report Canvas ===__NOEDITSECTION__<br />
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.<br />
<br />
===Properties Pane ===__NOEDITSECTION__<br />
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.<br />
<br />
===Palette===__NOEDITSECTION__<br />
The Palette is the area where individual graphic elements can be selected and dragged onto the canvas. This includes subreports and crosstab elements.<br />
<br />
===Formatting Tools ===__NOEDITSECTION__<br />
The Formatting Tools pane provides access to various formatting functions designed to manage the size and space between elements on the report.<br />
<br />
===iReport Output ===__NOEDITSECTION__<br />
This pane displays any problems or output from the reports.<br />
<br />
==XML and Preview Views==__NOEDITSECTION__<br />
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.<br />
<div align="center"><br />
[[Image:iReportXMLView.png|center|500px|''XML View'']]<br />
''XML View''<br />
</div>.<br />
<br />
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 function as desired prior to importing into {(IMSMANG}}. This is the primary method for running iReport templates within the iReport Designer.<br />
<div align="center"><br />
[[Image:IReportPreview.png|center|500px|''Preview View'']]<br />
''Preview View''<br />
</div>.<br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Start_and_Configure_iReport&diff=11556Start and Configure iReport2013-09-23T19:28:50Z<p>Noah: </p>
<hr />
<div>{{TOC right}}<br />
The sections in this article will guide you through starting and configuring iReport. <br />
<br />
===Starting iReport===__NOEDITSECTION__<br />
iReport is installed with IMSMA and may be started via the IMSMA Tray Launcher. To start iReport:<br />
<ol><br />
<li>Ensure that the IMSMA server is started</li><br />
<li>Right-click the '''IMSMA Control Centre''' icon that is displayed in the lower, right corner of your Windows’ desktop.</li><br />
<li>Select the '''iReport''' option.</li><br />
<li>Select the '''Start iReport''' option.</li><br />
</ol><br />
<br />
===Configuration===__NOEDITSECTION__<br />
{{note|The steps in this section will only need to be completed once.}}<br />
<br />
===Setting the Compilation Directory===__NOEDITSECTION__<br />
As reports are generated, iReport creates several files which it uses to produce the report results. <br />
To set the compilation directory:<br />
<ol><br />
<li>From the '''Options''' menu, select '''Settings'''.</li><br />
:The iReport – Options window displays the General tab.<br />
<li>Select the '''Compiler''' tab.</li><br />
<li>Check the '''Use Reports Directory to Compile''' checkbox.</li><br />
<li>Click the '''Save''' button.</li><br />
:The iReport – Options window closes.<br />
</ol><br />
<br />
===Importing Data Sources===__NOEDITSECTION__<br />
To import the data sources that are available for IMSMA:<br />
<ol start="5"><br />
<li>From the Data menu, select Connection/Data Sources.</li><br />
:The Connections/Datasources window displays.<br />
<li>Click the '''Import''' button.</li><br />
:The Open window displays.<br />
<li>From the Open window:</li><br />
<ol type="a"><br />
<li>Navigate to the <IMSMA Installation Directory>\iReport\IMSMA Data Sources directory.</li><br />
<li>Select the IMSMA data sources.xml file.</li><br />
<li>Click the '''Open''' button.</li><br />
:A window displays how many connections were imported. <br />
</ol><br />
<li>Click the '''OK''' button to close the window that displays the number of imported connections.</li><br />
<li>Close the Connections/Datasources window by clicking the [[Image:IReportX.png]] button displayed in the upper, right corner of the window.</li><br />
</ol><br />
<br />
{{note|Although numerous IMSMA data sources are available via iReport, only the following data sources should be used as the primary data source for a report: accident, Data Entry Form, land, activity, location, education, organisation, place, QM, and victim.}}<br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Use_iReport&diff=11555Use iReport2013-09-23T19:28:26Z<p>Noah: </p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure iReport]]<br />
|[[Use i-Report|Use iReport]]<br />
|[[Create a Basic i-Report Template|Create a Basic iReport Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create iReport Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize iReport Template Data]]<br />
}}<br />
<br />
==Introduction to iReport==__NOEDITSECTION__<br />
iReport Designer (also known as iReport) is a third-party application that allows you to generate custom-defined reports on IMSMA data. Using iReport, you may define the attributes that are returned by a report and also customise the appearance of the report. Report templates designed in iReport can be imported into {{IMSMANG}} and run by {{IMSMANG}} users to extract data based on search criteria. Reports can be exported to PDF, RTF, XLS, and other formats. iReport Designer version 5.0.1 is included with the {{IMSMANG}} distribution. Using iReport Designer, users create .jrxml iReport templates, a kind of xml report definition, that can be used by {{IMSMANG}} to [[I-Report_Templates|produce a formatted report]].<br />
<br />
==iReport Basics==__NOEDITSECTION__<br />
iReport uses standard reporting terms to refer to the basic building blocks of a report templates<br />
===Data Sources===__NOEDITSECTION__<br />
Data sources in iReport refer to the connection between the report template and the {{IMSMANG}} database. Each iReport template will have one data source. Data sources in iReport generally refer to items in {{IMSMANG}} such as Land, Activity, Education, Accident, Victim, etc. Available data sources include:<br />
{| class="wikitable" style="margin: 1em auto 1em auto;"<br />
|+Available Data Sources<br />
|-<br />
| Accident ||MRE Detail <br />
|-<br />
| Assistance Classification ||Needs Assessment Classification <br />
|-<br />
| Cause Classification ||Ordnance <br />
|-<br />
| Field Report ||Organisation <br />
|-<br />
| Gazetteer ||Place <br />
|-<br />
| Geopoint ||QM <br />
|-<br />
| Geospatialinfo ||Question <br />
|-<br />
| Hazard ||Received MRE <br />
|-<br />
| Hazard Device ||Task <br />
|-<br />
| Hazard Reduction ||Victim <br />
|-<br />
| Hazard Reduction Device ||Victim Assistance <br />
|-<br />
| Impact Survey ||Victim Assistance Assistance <br />
|-<br />
| Interviewee ||Victim Cause <br />
|-<br />
| Link ||Victim Needs Assessment <br />
|-<br />
| Location ||Work Item <br />
|-<br />
| <br />
|}<br />
<br />
The iReport datasource management and selection window can be found just below the menu bar in iReport Designer.<br />
[[Image:IReport Datasources Window.png|center|500px|''Datasource selection window'']]<br />
<div align="center"><br />
''iReport Datasource Selection Window''<br />
</div><br />
<br />
===Fields===__NOEDITSECTION__ <br />
Fields in iReport refer to individual IMSMA data elements that are available from a data source. Fields are denoted in iReport using the following syntax '''''$F{fieldname}''''' (e.g. '''''$F{guid}'''''). Each data source contains a list of available fields.<br />
===Variables===__NOEDITSECTION__ <br />
Variables in iReport are created within the iReport template to manipulate or calculate data. Using variables, users can create calculations such as sums, counts, averages, or other totals. Variables are denoted in iReport using the following syntax '''''$V{variablename}''''' (e.g. '''''$V{SumAreaSize}'''''). Variables can use field and/or parameter data.<br />
===Parameters===__NOEDITSECTION__ <br />
Parameters in iReport are used to accept and transfer external information, such as information from another report. Parameters are denoted in iReport using the following syntax '''''$P{paramtername}''''' (e.g. '''''$P{ParentGuid}''''')<br />
===Bands===__NOEDITSECTION__ <br />
Bands are used in iReport to specify areas on the resulting report. Each band acts differently in a report. The most used bands in iReport are:<br />
{| class="wikitable" style="margin: 1em auto 1em auto;"<br />
|-<br />
! Band Name !! Use<br />
|-<br />
| Title || Displayed once at the beginning of the report<br />
|-<br />
| Column or Group Header || Displayed at the top of each page or section<br />
|-<br />
| Detail || Displayed once for each data row returned by the report. Most often data elements will exist in this band.<br />
|-<br />
| Summary || Displayed once at the end of the report. Useful for charts, crosstabs, and totals.<br />
|}<br />
<br />
===Groups===__NOEDITSECTION__ <br />
Groups in iReport are used to display records with one or more common values together on a report. For example, Land with the same value for "Province" could be grouped together in a report. Groups can be added in the iReport Wizard or after a report has been created.<br />
===Subreports===__NOEDITSECTION__ <br />
Subreports are used in iReport to include more than one data source in a report. For example, to include information about Activities performed on a particular Land, you would include an Activity subreport in the Land report.<br />
===Crosstabs, Charts, and Formatting Elements===__NOEDITSECTION__ <br />
In addition to the iReport elements addressed above, additional specialized iReport elements are available to include in iReport templates including Crosstabs, Charts, and additional formatting elements such as lines, rectangles, etc. Crosstabs and chart elements typically belong only in the Summary band of a report while formatting elements including images can be included anywhere within the report template.<br />
<br />
{{Note | All field, variable, and parameter references in {{IMSMANG}} are case-sensitive}}<br />
<br />
==Creating an iReport Template Using the Wizard==__NOEDITSECTION__<br />
{{IMSMANG}} provides an iReport Wizard to simplify the creation of iReport templates. <br />
[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
<br />
{{NavBox HowTo Standardizing Data Analysis and Information Reporting}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Create_a_Basic_iReport_Template&diff=11554Create a Basic iReport Template2013-09-23T19:27:32Z<p>Noah: </p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
<br />
|[[Start and Configure i-Report|Start and Configure iReport]]<br />
|[[Create a Basic i-Report Template|Create a Basic iReport Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create iReport Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize iReport Template Data]]<br />
}}<br />
<br />
==Creating a Basic Report Using the Wizard==__NOEDITSECTION__<br />
{{IMSMANG}} provides an iReport Wizard to help in the process of creating new iReport templates. To create an iReport template using the Wizard:<br />
<br />
<ol><br />
<li>From the '''File''' menu, select '''New...'''. </li><br />
:The iReport Wizard window displays. <br />
<li>From the '''Report Templates''' list, select the template you would like to use for your report. Blank A4 or an IMSMA specific template are preferrable</li><br />
</ol><br />
<br />
<div align="center"><br />
[[Image:iReport Wizard1.png|center|500px|''Figure 1. iReport Wizard – Step 1'']]<br />
''Figure 1. iReport Wizard – Step 1''<br />
</div><br />
<br />
<ol start="3"><br />
<li>Click the '''Launch Report Wizard''' button.</li><br />
:The window to name the report and file location displays.<br />
</ol><br />
<br />
<div align="center"><br />
[[Image:iReport Wizard2.png|center|500px|''Figure 2. iReport Wizard - Step 2'']]<br />
''Figure 2. iReport Wizard - Step 2''<br />
</div><br />
<br />
<ol start="4"><br />
<li>Select the desired Data Source for the report and choose '''Next'''</li><br />
</ol><br />
<div align="center"><br />
[[Image:iReport Wizard3.png|center|500px|''Figure 2. iReport Wizard - Step 3'']]<br />
''Figure 3. iReport Wizard - Step 3''<br />
</div><br />
<br />
<ol start="5"><br />
<li>Select the desired data fields for the report and choose '''Next'''</li><br />
</ol><br />
<div align="center"><br />
[[Image:iReport Wizard4.png|center|500px|''Figure 2. iReport Wizard - Step 4'']]<br />
''Figure 4. iReport Wizard - Step 4''<br />
<br />
<br />
<br />
{| class="wikitable" width="500"<br />
|-<br />
| align="center" colspan="2" | '''Table 2. iReport Wizard – Buttons for selecting fields'''<br />
|-<br />
| width="125pt" | '''Button'''<br />
| width="375pt" | '''Description'''<br />
|-<br />
| align="center" | [[Image:iRepRA.png]] || Includes the selected field in the report.<br />
|-<br />
| align="center" | [[Image:iRepDRA.png]] || Includes data for all fields in the report.<br />
|-<br />
| align="center" | [[Image:iRepLA.png]] || Removes the selected field from the report.<br />
|-<br />
| align="center" | [[Image:iRepDLA.png]] || Indicates all fields from the report.<br />
|}<br />
</div><br />
<br />
{{note|It is recommended to always include the ''guid'' field when designing a report}}<br />
<br />
<ol start="6"><br />
<li>Click the '''Next''':<br />
The window to group the report data displays. 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><br />
</ol><br />
<div align="center"><br />
[[Image:iReport Wizard5.png|center|500px|''Figure 5. iReport Wizard - Step 5'']]<br />
<br />
''Figure 5. iReport Wizard - Step 5''<br />
</div><br />
<ol start="7"><br />
<li>Click the '''Next''' button and then '''Finish'''</li><br />
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.<br />
</ol><br />
<br />
<br />
<div align="center"><br />
[[Image:iReportHome1.png|center|500px|''Figure 2. iReport Wizard - Final Step'']]<br />
''Figure 6. iReport Wizard - Final Step''<br />
</div><br />
<br />
==iReport Designer Orientation==__NOEDITSECTION__<br />
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 '''Window''' menu.<br />
<div align="center"><br />
[[Image:IReportPanes2.png|center|500px|''iReport Panes'']]<br />
''iReport Panes''<br />
</div><br />
<br />
===Report Inspector === __NOEDITSECTION__<br />
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.<br />
<br />
===Report Canvas ===__NOEDITSECTION__<br />
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.<br />
<br />
===Properties Pane ===__NOEDITSECTION__<br />
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.<br />
<br />
===Palette===__NOEDITSECTION__<br />
The Palette is the area where individual graphic elements can be selected and dragged onto the canvas. This includes subreports and crosstab elements.<br />
<br />
===Formatting Tools ===__NOEDITSECTION__<br />
The Formatting Tools pane provides access to various formatting functions designed to manage the size and space between elements on the report.<br />
<br />
===iReport Output ===__NOEDITSECTION__<br />
This pane displays any problems or output from the reports.<br />
<br />
==XML and Preview Views==__NOEDITSECTION__<br />
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.<br />
<div align="center"><br />
[[Image:iReportXMLView.png|center|500px|''XML View'']]<br />
''XML View''<br />
</div>.<br />
<br />
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 function as desired prior to importing into {(IMSMANG}}. This is the primary method for running iReport templates within the iReport Designer.<br />
<div align="center"><br />
[[Image:IReportPreview.png|center|500px|''Preview View'']]<br />
''Preview View''<br />
</div>.<br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Use_iReport&diff=11553Use iReport2013-09-23T19:23:25Z<p>Noah: </p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Introduction to iReport==__NOEDITSECTION__<br />
iReport Designer (also known as iReport) is a third-party application that allows you to generate custom-defined reports on IMSMA data. Using iReport, you may define the attributes that are returned by a report and also customise the appearance of the report. Report templates designed in iReport can be imported into {{IMSMANG}} and run by {{IMSMANG}} users to extract data based on search criteria. Reports can be exported to PDF, RTF, XLS, and other formats. iReport Designer version 5.0.1 is included with the {{IMSMANG}} distribution. Using iReport Designer, users create .jrxml iReport templates, a kind of xml report definition, that can be used by {{IMSMANG}} to [[I-Report_Templates|produce a formatted report]].<br />
<br />
==iReport Basics==__NOEDITSECTION__<br />
iReport uses standard reporting terms to refer to the basic building blocks of a report templates<br />
===Data Sources===__NOEDITSECTION__<br />
Data sources in iReport refer to the connection between the report template and the {{IMSMANG}} database. Each iReport template will have one data source. Data sources in iReport generally refer to items in {{IMSMANG}} such as Land, Activity, Education, Accident, Victim, etc. Available data sources include:<br />
{| class="wikitable" style="margin: 1em auto 1em auto;"<br />
|+Available Data Sources<br />
|-<br />
| Accident ||MRE Detail <br />
|-<br />
| Assistance Classification ||Needs Assessment Classification <br />
|-<br />
| Cause Classification ||Ordnance <br />
|-<br />
| Field Report ||Organisation <br />
|-<br />
| Gazetteer ||Place <br />
|-<br />
| Geopoint ||QM <br />
|-<br />
| Geospatialinfo ||Question <br />
|-<br />
| Hazard ||Received MRE <br />
|-<br />
| Hazard Device ||Task <br />
|-<br />
| Hazard Reduction ||Victim <br />
|-<br />
| Hazard Reduction Device ||Victim Assistance <br />
|-<br />
| Impact Survey ||Victim Assistance Assistance <br />
|-<br />
| Interviewee ||Victim Cause <br />
|-<br />
| Link ||Victim Needs Assessment <br />
|-<br />
| Location ||Work Item <br />
|-<br />
| <br />
|}<br />
<br />
The iReport datasource management and selection window can be found just below the menu bar in iReport Designer.<br />
[[Image:IReport Datasources Window.png|center|500px|''Datasource selection window'']]<br />
<div align="center"><br />
''iReport Datasource Selection Window''<br />
</div><br />
<br />
===Fields===__NOEDITSECTION__ <br />
Fields in iReport refer to individual IMSMA data elements that are available from a data source. Fields are denoted in iReport using the following syntax '''''$F{fieldname}''''' (e.g. '''''$F{guid}'''''). Each data source contains a list of available fields.<br />
===Variables===__NOEDITSECTION__ <br />
Variables in iReport are created within the iReport template to manipulate or calculate data. Using variables, users can create calculations such as sums, counts, averages, or other totals. Variables are denoted in iReport using the following syntax '''''$V{variablename}''''' (e.g. '''''$V{SumAreaSize}'''''). Variables can use field and/or parameter data.<br />
===Parameters===__NOEDITSECTION__ <br />
Parameters in iReport are used to accept and transfer external information, such as information from another report. Parameters are denoted in iReport using the following syntax '''''$P{paramtername}''''' (e.g. '''''$P{ParentGuid}''''')<br />
===Bands===__NOEDITSECTION__ <br />
Bands are used in iReport to specify areas on the resulting report. Each band acts differently in a report. The most used bands in iReport are:<br />
{| class="wikitable" style="margin: 1em auto 1em auto;"<br />
|-<br />
! Band Name !! Use<br />
|-<br />
| Title || Displayed once at the beginning of the report<br />
|-<br />
| Column or Group Header || Displayed at the top of each page or section<br />
|-<br />
| Detail || Displayed once for each data row returned by the report. Most often data elements will exist in this band.<br />
|-<br />
| Summary || Displayed once at the end of the report. Useful for charts, crosstabs, and totals.<br />
|}<br />
<br />
===Groups===__NOEDITSECTION__ <br />
Groups in iReport are used to display records with one or more common values together on a report. For example, Land with the same value for "Province" could be grouped together in a report. Groups can be added in the iReport Wizard or after a report has been created.<br />
===Subreports===__NOEDITSECTION__ <br />
Subreports are used in iReport to include more than one data source in a report. For example, to include information about Activities performed on a particular Land, you would include an Activity subreport in the Land report.<br />
===Crosstabs, Charts, and Formatting Elements===__NOEDITSECTION__ <br />
In addition to the iReport elements addressed above, additional specialized iReport elements are available to include in iReport templates including Crosstabs, Charts, and additional formatting elements such as lines, rectangles, etc. Crosstabs and chart elements typically belong only in the Summary band of a report while formatting elements including images can be included anywhere within the report template.<br />
<br />
{{Note | All field, variable, and parameter references in {{IMSMANG}} are case-sensitive}}<br />
<br />
==Creating an iReport Template Using the Wizard==__NOEDITSECTION__<br />
{{IMSMANG}} provides an iReport Wizard to simplify the creation of iReport templates. <br />
[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
<br />
{{NavBox HowTo Standardizing Data Analysis and Information Reporting}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Use_iReport&diff=11552Use iReport2013-09-23T19:23:06Z<p>Noah: </p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Introduction to iReport==__NOEDITSECTION__<br />
iReport Designer (also known as iReport) is a third-party application that allows you to generate custom-defined reports on IMSMA data. Using iReport, you may define the attributes that are returned by a report and also customise the appearance of the report. Report templates designed in iReport can be imported into {{IMSMANG}} and run by {{IMSMANG}} users to extract data based on search criteria. Reports can be exported to PDF, RTF, XLS, and other formats. iReport Designer version 5.0.1 is included with the {{IMSMANG}} distribution. Using iReport Designer, users create .jrxml iReport templates, a kind of xml report definition, that can be used by {{IMSMANG}} to [[I-Report_Templates|produce a formatted report]].<br />
<br />
==iReport Basics==__NOEDITSECTION__<br />
iReport uses standard reporting terms to refer to the basic building blocks of a report templates<br />
===Data Sources===__NOEDITSECTION__<br />
Data sources in iReport refer to the connection between the report template and the {{IMSMANG}} database. Each iReport template will have one data source. Data sources in iReport generally refer to items in {{IMSMANG}} such as Land, Activity, Education, Accident, Victim, etc. Available data sources include:<br />
{| class="wikitable" style="margin: 1em auto 1em auto;"<br />
|+Available Data Sources<br />
|-<br />
| Accident ||MRE Detail <br />
|-<br />
| Assistance Classification ||Needs Assessment Classification <br />
|-<br />
| Cause Classification ||Ordnance <br />
|-<br />
| Field Report ||Organisation <br />
|-<br />
| Gazetteer ||Place <br />
|-<br />
| Geopoint ||QM <br />
|-<br />
| Geospatialinfo ||Question <br />
|-<br />
| Hazard ||Received MRE <br />
|-<br />
| Hazard Device ||Task <br />
|-<br />
| Hazard Reduction ||Victim <br />
|-<br />
| Hazard Reduction Device ||Victim Assistance <br />
|-<br />
| Impact Survey ||Victim Assistance Assistance <br />
|-<br />
| Interviewee ||Victim Cause <br />
|-<br />
| Link ||Victim Needs Assessment <br />
|-<br />
| Location ||Work Item <br />
|-<br />
| <br />
|}<br />
|}<br />
<br />
The iReport datasource management and selection window can be found just below the menu bar in iReport Designer.<br />
[[Image:IReport Datasources Window.png|center|500px|''Datasource selection window'']]<br />
<div align="center"><br />
''iReport Datasource Selection Window''<br />
</div><br />
<br />
===Fields===__NOEDITSECTION__ <br />
Fields in iReport refer to individual IMSMA data elements that are available from a data source. Fields are denoted in iReport using the following syntax '''''$F{fieldname}''''' (e.g. '''''$F{guid}'''''). Each data source contains a list of available fields.<br />
===Variables===__NOEDITSECTION__ <br />
Variables in iReport are created within the iReport template to manipulate or calculate data. Using variables, users can create calculations such as sums, counts, averages, or other totals. Variables are denoted in iReport using the following syntax '''''$V{variablename}''''' (e.g. '''''$V{SumAreaSize}'''''). Variables can use field and/or parameter data.<br />
===Parameters===__NOEDITSECTION__ <br />
Parameters in iReport are used to accept and transfer external information, such as information from another report. Parameters are denoted in iReport using the following syntax '''''$P{paramtername}''''' (e.g. '''''$P{ParentGuid}''''')<br />
===Bands===__NOEDITSECTION__ <br />
Bands are used in iReport to specify areas on the resulting report. Each band acts differently in a report. The most used bands in iReport are:<br />
{| class="wikitable" style="margin: 1em auto 1em auto;"<br />
|-<br />
! Band Name !! Use<br />
|-<br />
| Title || Displayed once at the beginning of the report<br />
|-<br />
| Column or Group Header || Displayed at the top of each page or section<br />
|-<br />
| Detail || Displayed once for each data row returned by the report. Most often data elements will exist in this band.<br />
|-<br />
| Summary || Displayed once at the end of the report. Useful for charts, crosstabs, and totals.<br />
|}<br />
<br />
===Groups===__NOEDITSECTION__ <br />
Groups in iReport are used to display records with one or more common values together on a report. For example, Land with the same value for "Province" could be grouped together in a report. Groups can be added in the iReport Wizard or after a report has been created.<br />
===Subreports===__NOEDITSECTION__ <br />
Subreports are used in iReport to include more than one data source in a report. For example, to include information about Activities performed on a particular Land, you would include an Activity subreport in the Land report.<br />
===Crosstabs, Charts, and Formatting Elements===__NOEDITSECTION__ <br />
In addition to the iReport elements addressed above, additional specialized iReport elements are available to include in iReport templates including Crosstabs, Charts, and additional formatting elements such as lines, rectangles, etc. Crosstabs and chart elements typically belong only in the Summary band of a report while formatting elements including images can be included anywhere within the report template.<br />
<br />
{{Note | All field, variable, and parameter references in {{IMSMANG}} are case-sensitive}}<br />
<br />
==Creating an iReport Template Using the Wizard==__NOEDITSECTION__<br />
{{IMSMANG}} provides an iReport Wizard to simplify the creation of iReport templates. <br />
[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
<br />
{{NavBox HowTo Standardizing Data Analysis and Information Reporting}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Use_iReport&diff=11549Use iReport2013-09-23T19:06:33Z<p>Noah: </p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Introduction to iReport==__NOEDITSECTION__<br />
iReport Designer (also known as iReport) is a third-party application that allows you to generate custom-defined reports on IMSMA data. Using iReport, you may define the attributes that are returned by a report and also customise the appearance of the report. Report templates designed in iReport can be imported into {{IMSMANG}} and run by {{IMSMANG}} users to extract data based on search criteria. Reports can be exported to PDF, RTF, XLS, and other formats. iReport Designer version 5.0.1 is included with the {{IMSMANG}} distribution. Using iReport Designer, users create .jrxml iReport templates, a kind of xml report definition, that can be used by {{IMSMANG}} to [[I-Report_Templates|produce a formatted report]].<br />
<br />
==iReport Basics==__NOEDITSECTION__<br />
iReport uses standard reporting terms to refer to the basic building blocks of a report templates<br />
===Data Sources===__NOEDITSECTION__<br />
Data sources in iReport refer to the connection between the report template and the {{IMSMANG}} database. Each iReport template will have one data source. Data sources in iReport generally refer to items in {{IMSMANG}} such as Land, Activity, Education, Accident, Victim, etc. Available data sources include:<br />
{| class="wikitable" style="margin: 1em auto 1em auto;"<br />
|+Available Data Sources<br />
|-<br />
|Accident || MRE <br />
|-<br />
|Assistance Classification || MRE Detail <br />
|-<br />
|Cause Classification || Needs Assessment Classification <br />
|-<br />
|Field Report || Ordnance <br />
|-<br />
|Gazetteer || Organisation <br />
|-<br />
|Geopoint || Place <br />
|-<br />
|Geospatialinfo || QM <br />
|-<br />
|Hazard || Question <br />
|-<br />
|Hazard Device || Received MRE <br />
|-<br />
|Hazard Reduction || Task <br />
|-<br />
|Hazard Reduction Device || Victim <br />
|-<br />
|Impact Survey || Victim Assistnace <br />
|-<br />
|Interviewee || Work Item <br />
|-|Link || <br />
<br />
|}<br />
<br />
The iReport datasource management and selection window can be found just below the menu bar in iReport Designer.<br />
[[Image:IReport Datasources Window.png|center|500px|''Datasource selection window'']]<br />
<div align="center"><br />
''iReport Datasource Selection Window''<br />
</div><br />
<br />
===Fields===__NOEDITSECTION__ <br />
Fields in iReport refer to individual IMSMA data elements that are available from a data source. Fields are denoted in iReport using the following syntax '''''$F{fieldname}''''' (e.g. '''''$F{guid}'''''). Each data source contains a list of available fields.<br />
===Variables===__NOEDITSECTION__ <br />
Variables in iReport are created within the iReport template to manipulate or calculate data. Using variables, users can create calculations such as sums, counts, averages, or other totals. Variables are denoted in iReport using the following syntax '''''$V{variablename}''''' (e.g. '''''$V{SumAreaSize}'''''). Variables can use field and/or parameter data.<br />
===Parameters===__NOEDITSECTION__ <br />
Parameters in iReport are used to accept and transfer external information, such as information from another report. Parameters are denoted in iReport using the following syntax '''''$P{paramtername}''''' (e.g. '''''$P{ParentGuid}''''')<br />
===Bands===__NOEDITSECTION__ <br />
Bands are used in iReport to specify areas on the resulting report. Each band acts differently in a report. The most used bands in iReport are:<br />
{| class="wikitable" style="margin: 1em auto 1em auto;"<br />
|-<br />
! Band Name !! Use<br />
|-<br />
| Title || Displayed once at the beginning of the report<br />
|-<br />
| Column or Group Header || Displayed at the top of each page or section<br />
|-<br />
| Detail || Displayed once for each data row returned by the report. Most often data elements will exist in this band.<br />
|-<br />
| Summary || Displayed once at the end of the report. Useful for charts, crosstabs, and totals.<br />
|}<br />
<br />
===Groups===__NOEDITSECTION__ <br />
Groups in iReport are used to display records with one or more common values together on a report. For example, Land with the same value for "Province" could be grouped together in a report. Groups can be added in the iReport Wizard or after a report has been created.<br />
===Subreports===__NOEDITSECTION__ <br />
Subreports are used in iReport to include more than one data source in a report. For example, to include information about Activities performed on a particular Land, you would include an Activity subreport in the Land report.<br />
===Crosstabs, Charts, and Formatting Elements===__NOEDITSECTION__ <br />
In addition to the iReport elements addressed above, additional specialized iReport elements are available to include in iReport templates including Crosstabs, Charts, and additional formatting elements such as lines, rectangles, etc. Crosstabs and chart elements typically belong only in the Summary band of a report while formatting elements including images can be included anywhere within the report template.<br />
<br />
{{Note | All field, variable, and parameter references in {{IMSMANG}} are case-sensitive}}<br />
<br />
==Creating an iReport Template Using the Wizard==__NOEDITSECTION__<br />
{{IMSMANG}} provides an iReport Wizard to simplify the creation of iReport templates. <br />
[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
<br />
{{NavBox HowTo Standardizing Data Analysis and Information Reporting}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Format_an_iReport_Template&diff=11484Format an iReport Template2013-09-22T00:22:32Z<p>Noah: /* Text Properties */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
iReport Designer provides many ways to format the appearance of an iReport template. These include the ability to:<br />
*add formatting elements to the iReport such as lines, rectangles, circles, etc <br />
*edit the position and size of elements on the iReport template relative to one another<br />
*change colors, fonts, and other properties<br />
*perform conditional displays based on data in the report<br />
<br />
<br />
==Adding Formatting Elements==<br />
Additional formatting elements can be added to the iReport template. These include lines, boxes, circles, etc. To add these elements to iReport template:<br />
# Ensure that '''Palette''' pane is available. If not, on the '''Window''' menu, select '''Palette'''.<br />
# Select the desired element and drag it to the iReport template.<br />
<br />
==Formatting iReport Elements==<br />
iReport Designer allows you to apply specific formatting to individual elements on an iReport template. Many of these elements can be edited graphically using [[#Formatting Tools|Formatting Tools]]<br />
# Select the desired field or variable displayed in the iReport template ('''note:''' this is '''NOT''' the field or variable value itself in the '''iReport Designer''', but rather the text element on the report displaying the field value)<br />
#: [[Image:IReport Display Properties.png|center|300px|''Display Properties'']]<div align="center">''Display Properties''</div><br />
<br />
===Position and Size Elements===<br />
*Left<br />
*Top<br />
*Width<br />
*Height<br />
<br />
===Color===<br />
*Forecolor<br />
*BackColor<br />
*Opaque<br />
<br />
===Text Properties===<br />
iReport Designer allows you to set various properties for text elements displayed in the report template. These can be edited either with the text formatting bar:<br />
[[Image:IReport Formatting Bar.png|center|300px|''Text Formatting Bar'']]<div align="center">''Text Formatting Bar''</div><br />
<br />
or with the '''Text properties''' portion of the '''Properties''' pane<br />
[[Image:IReport Text Properties.png|center|300px|''Text Properties'']]<div align="center">''Text Properties''</div><br />
*Font Name<br />
*Size<br />
*Bold/Italic<br />
*Horizontal and Vertical Alignment<br />
<br />
===Number and Date Specific Patterns===<br />
* On the '''Properties''' pane select the '''Pattern''' element and open the '''Pattern Editor''''. <br />
*: [[Image:IReport Pattern Properties.png|center|300px|''Pattern Window'']]<div align="center">''Pattern Window''</div><br />
** Choose an appropriate '''Pattern''' to apply to the field as desired.<br />
<br />
===Position Type===<br />
Because iReport elements can expand beyond their expected or allocated vertical space on the report template, elements can occasionally "collide" or overlap one another in the final report. To manage the potential conflict iReport provides the '''Position Type''' property on all elements. <br />
[[Image:IReport Display Properties.png|center|300px|''Formatting Tools'']]<div align="center">''Formatting Tools''</div><br />
<br />
The '''Position Type''' property has three options:<br />
*"fix relative to top": This is the default value for all elements and means that the position will be kept relative to the top margin of the report regardless of what data is displayed before it.<br />
*"fix relative to bottom": This value means that the position will be kept relative to the bottom margin of the report regardless of what data is displayed after it.<br />
*"float": This value allows the element to "float" and will display the element relative to elements that come before it (i.e. closer to the top or closer to the left margins). <br />
<br />
Using the '''float''' Position Type can help eliminate the overlapping that can occur when displaying multiple charts or cross tabs in a single report template.<br />
<br />
==Formatting Tools==<br />
iReport Designer provides a variety of formatting tools for aligning, spacing, and sizing elements on the report template. These can be applied using the '''Formatting Tools''' pane. <br />
# Ensure that '''Formatting Tools''' pane is available. If not, on the '''Window''' menu, select '''Formatting Tools'''.<br />
#: [[Image:IReport Formatting Tools.png|center|300px|''Formatting Tools'']]<div align="center">''Formatting Tools''</div><br />
# Select the desired element or elements (multiple elements can be selected by using the '''Control-click''' key combination) and apply the desired formatting choice.<br />
<br />
==Conditional Display==<br />
Sometimes it is important to change the display of some data extracted from IMSMA for the resulting report. For example, you want to change:<br />
* the value “null” to “no”<br />
* the value “Male” to “Men”<br />
To do this, you use conditional statements in the element on the iReport.<br />
<br />
# Select the desired field or variable displayed in the iReport template ('''note:''' this is '''NOT''' the field or variable value itself in the '''iReport Designer''', but rather the text element on the report displaying the field or variable value).<br />
#: [[Image:IReport Display Properties.png|center|300px|''Display Properties'']]<div align="center">''Display Properties''</div><br />
# On the '''Properties''' pane select the '''Text Expression''' and open the '''Text Expression Editor''''.<br />
#: [[Image:IReport Charts5.png|center|500px|''Text Expression Editor'']]<div align="center">''Text Expression Editor''</div><br />
# To change the way a particular field is displayed you can use basic "ïf-then-else" logic as in other [[Summarize i-Report Template Data#Variable Expressions|Variable Expressions]]. This follows the pattern:<br />
$F{field} == null ? “Something" : $F{field}<br />
<br />
Or nested:<br />
$F{field} == null ? “Something" : $F{field} == “SomethingElse” ? “Something Else“ : $F{field}<br />
<br />
{{note| The type of field is important (string, float, double, int, date). Stick with strings if you can.}}<br />
<br />
Example:<br />
$F{blockWater} == null ? “No value" : $F{blockWater}<br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Format_an_iReport_Template&diff=11483Format an iReport Template2013-09-22T00:20:33Z<p>Noah: /* Number and Date Specific Patterns */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
iReport Designer provides many ways to format the appearance of an iReport template. These include the ability to:<br />
*add formatting elements to the iReport such as lines, rectangles, circles, etc <br />
*edit the position and size of elements on the iReport template relative to one another<br />
*change colors, fonts, and other properties<br />
*perform conditional displays based on data in the report<br />
<br />
<br />
==Adding Formatting Elements==<br />
Additional formatting elements can be added to the iReport template. These include lines, boxes, circles, etc. To add these elements to iReport template:<br />
# Ensure that '''Palette''' pane is available. If not, on the '''Window''' menu, select '''Palette'''.<br />
# Select the desired element and drag it to the iReport template.<br />
<br />
==Formatting iReport Elements==<br />
iReport Designer allows you to apply specific formatting to individual elements on an iReport template. Many of these elements can be edited graphically using [[#Formatting Tools|Formatting Tools]]<br />
# Select the desired field or variable displayed in the iReport template ('''note:''' this is '''NOT''' the field or variable value itself in the '''iReport Designer''', but rather the text element on the report displaying the field value)<br />
#: [[Image:IReport Display Properties.png|center|300px|''Display Properties'']]<div align="center">''Display Properties''</div><br />
<br />
===Position and Size Elements===<br />
*Left<br />
*Top<br />
*Width<br />
*Height<br />
<br />
===Color===<br />
*Forecolor<br />
*BackColor<br />
*Opaque<br />
<br />
===Text Properties===<br />
[[Image:IReport Text Properties.png|center|300px|''Text Properties'']]<div align="center">''Text Properties''</div><br />
*Font Name<br />
*Size<br />
*Bold/Italic<br />
*Horizontal and Vertical Alignment<br />
*: [[Image:IReport Formatting Bar.png|center|300px|''Text Formatting Bar'']]<div align="center">''Text Formatting Bar''</div><br />
<br />
===Number and Date Specific Patterns===<br />
* On the '''Properties''' pane select the '''Pattern''' element and open the '''Pattern Editor''''. <br />
*: [[Image:IReport Pattern Properties.png|center|300px|''Pattern Window'']]<div align="center">''Pattern Window''</div><br />
** Choose an appropriate '''Pattern''' to apply to the field as desired.<br />
<br />
===Position Type===<br />
Because iReport elements can expand beyond their expected or allocated vertical space on the report template, elements can occasionally "collide" or overlap one another in the final report. To manage the potential conflict iReport provides the '''Position Type''' property on all elements. <br />
[[Image:IReport Display Properties.png|center|300px|''Formatting Tools'']]<div align="center">''Formatting Tools''</div><br />
<br />
The '''Position Type''' property has three options:<br />
*"fix relative to top": This is the default value for all elements and means that the position will be kept relative to the top margin of the report regardless of what data is displayed before it.<br />
*"fix relative to bottom": This value means that the position will be kept relative to the bottom margin of the report regardless of what data is displayed after it.<br />
*"float": This value allows the element to "float" and will display the element relative to elements that come before it (i.e. closer to the top or closer to the left margins). <br />
<br />
Using the '''float''' Position Type can help eliminate the overlapping that can occur when displaying multiple charts or cross tabs in a single report template.<br />
<br />
==Formatting Tools==<br />
iReport Designer provides a variety of formatting tools for aligning, spacing, and sizing elements on the report template. These can be applied using the '''Formatting Tools''' pane. <br />
# Ensure that '''Formatting Tools''' pane is available. If not, on the '''Window''' menu, select '''Formatting Tools'''.<br />
#: [[Image:IReport Formatting Tools.png|center|300px|''Formatting Tools'']]<div align="center">''Formatting Tools''</div><br />
# Select the desired element or elements (multiple elements can be selected by using the '''Control-click''' key combination) and apply the desired formatting choice.<br />
<br />
==Conditional Display==<br />
Sometimes it is important to change the display of some data extracted from IMSMA for the resulting report. For example, you want to change:<br />
* the value “null” to “no”<br />
* the value “Male” to “Men”<br />
To do this, you use conditional statements in the element on the iReport.<br />
<br />
# Select the desired field or variable displayed in the iReport template ('''note:''' this is '''NOT''' the field or variable value itself in the '''iReport Designer''', but rather the text element on the report displaying the field or variable value).<br />
#: [[Image:IReport Display Properties.png|center|300px|''Display Properties'']]<div align="center">''Display Properties''</div><br />
# On the '''Properties''' pane select the '''Text Expression''' and open the '''Text Expression Editor''''.<br />
#: [[Image:IReport Charts5.png|center|500px|''Text Expression Editor'']]<div align="center">''Text Expression Editor''</div><br />
# To change the way a particular field is displayed you can use basic "ïf-then-else" logic as in other [[Summarize i-Report Template Data#Variable Expressions|Variable Expressions]]. This follows the pattern:<br />
$F{field} == null ? “Something" : $F{field}<br />
<br />
Or nested:<br />
$F{field} == null ? “Something" : $F{field} == “SomethingElse” ? “Something Else“ : $F{field}<br />
<br />
{{note| The type of field is important (string, float, double, int, date). Stick with strings if you can.}}<br />
<br />
Example:<br />
$F{blockWater} == null ? “No value" : $F{blockWater}<br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Format_an_iReport_Template&diff=11482Format an iReport Template2013-09-22T00:20:15Z<p>Noah: /* Text Properties */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
iReport Designer provides many ways to format the appearance of an iReport template. These include the ability to:<br />
*add formatting elements to the iReport such as lines, rectangles, circles, etc <br />
*edit the position and size of elements on the iReport template relative to one another<br />
*change colors, fonts, and other properties<br />
*perform conditional displays based on data in the report<br />
<br />
<br />
==Adding Formatting Elements==<br />
Additional formatting elements can be added to the iReport template. These include lines, boxes, circles, etc. To add these elements to iReport template:<br />
# Ensure that '''Palette''' pane is available. If not, on the '''Window''' menu, select '''Palette'''.<br />
# Select the desired element and drag it to the iReport template.<br />
<br />
==Formatting iReport Elements==<br />
iReport Designer allows you to apply specific formatting to individual elements on an iReport template. Many of these elements can be edited graphically using [[#Formatting Tools|Formatting Tools]]<br />
# Select the desired field or variable displayed in the iReport template ('''note:''' this is '''NOT''' the field or variable value itself in the '''iReport Designer''', but rather the text element on the report displaying the field value)<br />
#: [[Image:IReport Display Properties.png|center|300px|''Display Properties'']]<div align="center">''Display Properties''</div><br />
<br />
===Position and Size Elements===<br />
*Left<br />
*Top<br />
*Width<br />
*Height<br />
<br />
===Color===<br />
*Forecolor<br />
*BackColor<br />
*Opaque<br />
<br />
===Text Properties===<br />
[[Image:IReport Text Properties.png|center|300px|''Text Properties'']]<div align="center">''Text Properties''</div><br />
*Font Name<br />
*Size<br />
*Bold/Italic<br />
*Horizontal and Vertical Alignment<br />
*: [[Image:IReport Formatting Bar.png|center|300px|''Text Formatting Bar'']]<div align="center">''Text Formatting Bar''</div><br />
<br />
===Number and Date Specific Patterns===<br />
** On the '''Properties''' pane select the '''Pattern''' element and open the '''Pattern Editor''''. <br />
*: [[Image:IReport Pattern Properties.png|center|300px|''Pattern Window'']]<div align="center">''Pattern Window''</div><br />
** Choose an appropriate '''Pattern''' to apply to the field as desired.<br />
===Position Type===<br />
Because iReport elements can expand beyond their expected or allocated vertical space on the report template, elements can occasionally "collide" or overlap one another in the final report. To manage the potential conflict iReport provides the '''Position Type''' property on all elements. <br />
[[Image:IReport Display Properties.png|center|300px|''Formatting Tools'']]<div align="center">''Formatting Tools''</div><br />
<br />
The '''Position Type''' property has three options:<br />
*"fix relative to top": This is the default value for all elements and means that the position will be kept relative to the top margin of the report regardless of what data is displayed before it.<br />
*"fix relative to bottom": This value means that the position will be kept relative to the bottom margin of the report regardless of what data is displayed after it.<br />
*"float": This value allows the element to "float" and will display the element relative to elements that come before it (i.e. closer to the top or closer to the left margins). <br />
<br />
Using the '''float''' Position Type can help eliminate the overlapping that can occur when displaying multiple charts or cross tabs in a single report template.<br />
<br />
==Formatting Tools==<br />
iReport Designer provides a variety of formatting tools for aligning, spacing, and sizing elements on the report template. These can be applied using the '''Formatting Tools''' pane. <br />
# Ensure that '''Formatting Tools''' pane is available. If not, on the '''Window''' menu, select '''Formatting Tools'''.<br />
#: [[Image:IReport Formatting Tools.png|center|300px|''Formatting Tools'']]<div align="center">''Formatting Tools''</div><br />
# Select the desired element or elements (multiple elements can be selected by using the '''Control-click''' key combination) and apply the desired formatting choice.<br />
<br />
==Conditional Display==<br />
Sometimes it is important to change the display of some data extracted from IMSMA for the resulting report. For example, you want to change:<br />
* the value “null” to “no”<br />
* the value “Male” to “Men”<br />
To do this, you use conditional statements in the element on the iReport.<br />
<br />
# Select the desired field or variable displayed in the iReport template ('''note:''' this is '''NOT''' the field or variable value itself in the '''iReport Designer''', but rather the text element on the report displaying the field or variable value).<br />
#: [[Image:IReport Display Properties.png|center|300px|''Display Properties'']]<div align="center">''Display Properties''</div><br />
# On the '''Properties''' pane select the '''Text Expression''' and open the '''Text Expression Editor''''.<br />
#: [[Image:IReport Charts5.png|center|500px|''Text Expression Editor'']]<div align="center">''Text Expression Editor''</div><br />
# To change the way a particular field is displayed you can use basic "ïf-then-else" logic as in other [[Summarize i-Report Template Data#Variable Expressions|Variable Expressions]]. This follows the pattern:<br />
$F{field} == null ? “Something" : $F{field}<br />
<br />
Or nested:<br />
$F{field} == null ? “Something" : $F{field} == “SomethingElse” ? “Something Else“ : $F{field}<br />
<br />
{{note| The type of field is important (string, float, double, int, date). Stick with strings if you can.}}<br />
<br />
Example:<br />
$F{blockWater} == null ? “No value" : $F{blockWater}<br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Format_an_iReport_Template&diff=11481Format an iReport Template2013-09-22T00:19:28Z<p>Noah: </p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
iReport Designer provides many ways to format the appearance of an iReport template. These include the ability to:<br />
*add formatting elements to the iReport such as lines, rectangles, circles, etc <br />
*edit the position and size of elements on the iReport template relative to one another<br />
*change colors, fonts, and other properties<br />
*perform conditional displays based on data in the report<br />
<br />
<br />
==Adding Formatting Elements==<br />
Additional formatting elements can be added to the iReport template. These include lines, boxes, circles, etc. To add these elements to iReport template:<br />
# Ensure that '''Palette''' pane is available. If not, on the '''Window''' menu, select '''Palette'''.<br />
# Select the desired element and drag it to the iReport template.<br />
<br />
==Formatting iReport Elements==<br />
iReport Designer allows you to apply specific formatting to individual elements on an iReport template. Many of these elements can be edited graphically using [[#Formatting Tools|Formatting Tools]]<br />
# Select the desired field or variable displayed in the iReport template ('''note:''' this is '''NOT''' the field or variable value itself in the '''iReport Designer''', but rather the text element on the report displaying the field value)<br />
#: [[Image:IReport Display Properties.png|center|300px|''Display Properties'']]<div align="center">''Display Properties''</div><br />
<br />
===Position and Size Elements===<br />
*Left<br />
*Top<br />
*Width<br />
*Height<br />
<br />
===Color===<br />
*Forecolor<br />
*BackColor<br />
*Opaque<br />
<br />
===Text Properties===<br />
*:[[Image:IReport Text Properties.png|center|300px|''Text Properties'']]<div align="center">''Text Properties''</div><br />
*Font Name<br />
*Size<br />
*Bold/Italic<br />
*Horizontal and Vertical Alignment<br />
*: [[Image:IReport Formatting Bar.png|center|300px|''Text Formatting Bar'']]<div align="center">''Text Formatting Bar''</div><br />
<br />
===Number and Date Specific Patterns===<br />
** On the '''Properties''' pane select the '''Pattern''' element and open the '''Pattern Editor''''. <br />
*: [[Image:IReport Pattern Properties.png|center|300px|''Pattern Window'']]<div align="center">''Pattern Window''</div><br />
** Choose an appropriate '''Pattern''' to apply to the field as desired.<br />
===Position Type===<br />
Because iReport elements can expand beyond their expected or allocated vertical space on the report template, elements can occasionally "collide" or overlap one another in the final report. To manage the potential conflict iReport provides the '''Position Type''' property on all elements. <br />
[[Image:IReport Display Properties.png|center|300px|''Formatting Tools'']]<div align="center">''Formatting Tools''</div><br />
<br />
The '''Position Type''' property has three options:<br />
*"fix relative to top": This is the default value for all elements and means that the position will be kept relative to the top margin of the report regardless of what data is displayed before it.<br />
*"fix relative to bottom": This value means that the position will be kept relative to the bottom margin of the report regardless of what data is displayed after it.<br />
*"float": This value allows the element to "float" and will display the element relative to elements that come before it (i.e. closer to the top or closer to the left margins). <br />
<br />
Using the '''float''' Position Type can help eliminate the overlapping that can occur when displaying multiple charts or cross tabs in a single report template.<br />
<br />
==Formatting Tools==<br />
iReport Designer provides a variety of formatting tools for aligning, spacing, and sizing elements on the report template. These can be applied using the '''Formatting Tools''' pane. <br />
# Ensure that '''Formatting Tools''' pane is available. If not, on the '''Window''' menu, select '''Formatting Tools'''.<br />
#: [[Image:IReport Formatting Tools.png|center|300px|''Formatting Tools'']]<div align="center">''Formatting Tools''</div><br />
# Select the desired element or elements (multiple elements can be selected by using the '''Control-click''' key combination) and apply the desired formatting choice.<br />
<br />
==Conditional Display==<br />
Sometimes it is important to change the display of some data extracted from IMSMA for the resulting report. For example, you want to change:<br />
* the value “null” to “no”<br />
* the value “Male” to “Men”<br />
To do this, you use conditional statements in the element on the iReport.<br />
<br />
# Select the desired field or variable displayed in the iReport template ('''note:''' this is '''NOT''' the field or variable value itself in the '''iReport Designer''', but rather the text element on the report displaying the field or variable value).<br />
#: [[Image:IReport Display Properties.png|center|300px|''Display Properties'']]<div align="center">''Display Properties''</div><br />
# On the '''Properties''' pane select the '''Text Expression''' and open the '''Text Expression Editor''''.<br />
#: [[Image:IReport Charts5.png|center|500px|''Text Expression Editor'']]<div align="center">''Text Expression Editor''</div><br />
# To change the way a particular field is displayed you can use basic "ïf-then-else" logic as in other [[Summarize i-Report Template Data#Variable Expressions|Variable Expressions]]. This follows the pattern:<br />
$F{field} == null ? “Something" : $F{field}<br />
<br />
Or nested:<br />
$F{field} == null ? “Something" : $F{field} == “SomethingElse” ? “Something Else“ : $F{field}<br />
<br />
{{note| The type of field is important (string, float, double, int, date). Stick with strings if you can.}}<br />
<br />
Example:<br />
$F{blockWater} == null ? “No value" : $F{blockWater}<br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Formatting_Bar.png&diff=11480File:IReport Formatting Bar.png2013-09-22T00:16:10Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Text_Properties.png&diff=11478File:IReport Text Properties.png2013-09-22T00:10:48Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Format_an_iReport_Template&diff=11476Format an iReport Template2013-09-22T00:03:56Z<p>Noah: </p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
iReport Designer provides many ways to format the appearance of an iReport template. These include the ability to:<br />
*add formatting elements to the iReport such as lines, rectangles, circles, etc <br />
*edit the position and size of elements on the iReport template relative to one another<br />
*change colors, fonts, and other properties<br />
*perform conditional displays based on data in the report<br />
<br />
==Conditional Display==<br />
Sometimes it is important to change the display of some data extracted from IMSMA for the resulting report. For example, you want to change:<br />
* the value “null” to “no”<br />
* the value “Male” to “Men”<br />
To do this, you use conditional statements in the element on the iReport.<br />
<br />
# Select the desired field or variable displayed in the iReport template ('''note:''' this is '''NOT''' the field or variable value itself in the '''iReport Designer''', but rather the text element on the report displaying the field or variable value).<br />
#: [[Image:IReport Display Properties.png|center|300px|''Display Properties'']]<div align="center">''Display Properties''</div><br />
# On the '''Properties''' pane select the '''Text Expression''' and open the '''Text Expression Editor''''.<br />
#: [[Image:IReport Charts5.png|center|500px|''Text Expression Editor'']]<div align="center">''Text Expression Editor''</div><br />
# To change the way a particular field is displayed you can use basic "ïf-then-else" logic as in other [[Summarize i-Report Template Data#Variable Expressions|Variable Expressions]]. This follows the pattern:<br />
$F{field} == null ? “Something" : $F{field}<br />
<br />
Or nested:<br />
$F{field} == null ? “Something" : $F{field} == “SomethingElse” ? “Something Else“ : $F{field}<br />
<br />
{{note| The type of field is important (string, float, double, int, date). Stick with strings if you can.}}<br />
<br />
Example:<br />
$F{blockWater} == null ? “No value" : $F{blockWater}<br />
<br />
==Formatting Dates and Numbers==<br />
iReport Designer allows you to apply specific date or number formats to fields of this type. As with other display properties:<br />
# Select the desired field or variable displayed in the iReport template ('''note:''' this is '''NOT''' the field or variable value itself in the '''iReport Designer''', but rather the text element on the report displaying the field value)<br />
#: [[Image:IReport Display Properties.png|center|300px|''Display Properties'']]<div align="center">''Display Properties''</div><br />
# On the '''Properties''' pane select the '''Pattern''' element and open the '''Pattern Editor''''. <br />
#: [[Image:IReport Pattern Properties.png|center|300px|''Pattern Window'']]<div align="center">''Pattern Window''</div><br />
#: Choose an appropriate '''Pattern''' to apply to the field as desired.<br />
<br />
==Adding Formatting Elements==<br />
Additional formatting elements can be added to the iReport template. These include lines, boxes, circles, etc. To add these elements to iReport template:<br />
# Ensure that '''Palette''' pane is available. If not, on the '''Window''' menu, select '''Palette'''.<br />
# Select the desired element and drag it to the iReport template.<br />
<br />
==Formatting Tools==<br />
iReport Designer provides a variety of formatting tools for aligning, spacing, and sizing elements on the report template. These can be applied using the '''Formatting Tools''' pane. <br />
# Ensure that '''Formatting Tools''' pane is available. If not, on the '''Window''' menu, select '''Formatting Tools'''.<br />
#: [[Image:IReport Formatting Tools.png|center|300px|''Formatting Tools'']]<div align="center">''Formatting Tools''</div><br />
# Select the desired element or elements (multiple elements can be selected by using the '''Control-click''' key combination) and apply the desired formatting choice.<br />
<br />
=="fix relative to" vs. "float"==<br />
Because iReport elements can expand beyond their expected or allocated vertical space on the report template, elements can occasionally "collide" or overlap one another in the final report. To manage the potential conflict iReport provides the '''Position Type''' property on all elements. <br />
[[Image:IReport Display Properties.png|center|300px|''Formatting Tools'']]<div align="center">''Formatting Tools''</div><br />
<br />
The '''Position Type''' property has three options:<br />
*"fix relative to top": This is the default value for all elements and means that the position will be kept relative to the top margin of the report regardless of what data is displayed before it.<br />
*"fix relative to bottom": This value means that the position will be kept relative to the bottom margin of the report regardless of what data is displayed after it.<br />
*"float": This value allows the element to "float" and will display the element relative to elements that come before it (i.e. closer to the top or closer to the left margins). <br />
<br />
Using the '''float''' Position Type can help eliminate the overlapping that can occur when displaying multiple charts or cross tabs in a single report template.<br />
<br />
<br />
<br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Formatting_Tools.png&diff=11474File:IReport Formatting Tools.png2013-09-21T23:54:02Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Pattern_Properties.png&diff=11473File:IReport Pattern Properties.png2013-09-21T23:45:15Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Display_Properties.png&diff=11472File:IReport Display Properties.png2013-09-21T23:45:01Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Format_an_iReport_Template&diff=11471Format an iReport Template2013-09-21T23:38:37Z<p>Noah: /* Conditional Display */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
iReport Designer provides many ways to format the appearance of an iReport template. These include the ability to:<br />
*add formatting elements to the iReport such as lines, rectangles, circles, etc <br />
*edit the position and size of elements on the iReport template relative to one another<br />
*change colors, fonts, and other properties<br />
*perform conditional displays based on data in the report<br />
<br />
==Conditional Display==<br />
Sometimes it is important to change the display of some data extracted from IMSMA for the resulting report. For example, you want to change:<br />
* the value “null” to “no”<br />
* the value “Male” to “Men”<br />
To do this, you use conditional statements in the element on the iReport.<br />
<br />
# Select the desired in the iReport template ('''note:''' this is '''NOT''' the field value, but rather the text element on the report displaying the field value)<br />
# On the '''Properties''' pane select the '''Text Expression''' and open the '''Text Expression Editor''''.<br />
#: [[Image:IReport Charts5.png|center|500px|''Text Expression Editor'']]<div align="center">''Text Expression Editor''</div><br />
# To change the way a particular field is displayed you can use basic "ïf-then-else" logic as in other [[Summarize i-Report Template Data#Variable Expressions|Variable Expressions]]. This follows the pattern:<br />
$F{field} == null ? “Something" : $F{field}<br />
<br />
Or nested:<br />
$F{field} == null ? “Something" : $F{field} == “SomethingElse” ? “Something Else“ : $F{field}<br />
<br />
{{note| The type of field is important (string, float, double, int, date). Stick with strings if you can.}}<br />
<br />
Example:<br />
$F{blockWater} == null ? “No value" : $F{blockWater}<br />
<br />
==Adding Formatting Elements==<br />
* Adding lines<br />
<br />
==Formatting Tools==<br />
* float vs fix relative<br />
<br />
==Working with Bands==<br />
<br />
==Formatting Subreports, Charts, and Crosstabs==<br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11469Summarize iReport Template Data2013-09-21T23:27:03Z<p>Noah: /* Charts */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===<br />
<br />
====Add a Pie Chart====<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
====Modify a Pie Chart====<br />
Once a chart has been created in iReport Designer, its properties can be edited by selecting the '''Chart Data''' option on the right click menu and adjusting the values and properties. <br />
<br />
To modify a chart:<br />
# Right click on the chart in iReport Designer and select '''Chart Data''' from the menu.<br />
# The Chart Data properties display.<br />
#: [[Image:IReport ChartData1.png|center|500px|''Chart Data Properties'']]<div align="center">''Chart Data Properties''</div><br />
# To edit the main properties of the chart, select the '''Details tab'''. Additionally, this screen can be used to edit the reset type of the chart which is relevant if the chart is displayed on a band other than the summary band.<br />
# The '''Chart Details''' window displays<br />
#: [[Image:IReport ChartData2.png|center|500px|''Chart Data Properties'']]<div align="center">''Chart Data Properties''</div><br />
# In this window, the basic properties of the chart that were established in the Chart Wizard can be edited. These include:<br />
#* '''Key Expression''': the field used to group data for charting purposes. To change the field, simply select another field. '''Note:''' The field must be used in the creation of the variable used in the value expression or the results will be incorrect.<br />
#* '''Value Expression''': the variable used to store the data to be displayed in the chart. If changes are made this value it is recommended to edit the variable properties as well.<br />
#* '''Label Expression''': the area used to define the labels for the chart. Any valid expression can be used here. See [[Summarize i-Report Template Data#Variable Expressions|Variable Expressions]] for more details.<br />
<br />
<br />
===Bar Charts===<br />
Bar charts, unlike Pie Charts, have a third variable option that can be included in the report. In addition to the category and value expressions, bar charts add the option of a '''''series'''''. The series choice adds an additional possibility of grouping data though is not required.<br />
<br />
====Add a Bar Chart====<br />
To add a bar chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the bar chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
# Provide a '''Series Expression''' (''optional''). <br />
#:[[Image:iReport Chart Bar1.png|center|500px|''Series Expression'']]<div align="center">''Series Expression''</div><br />
# The Series Expression allows you to define an added level of detail to your bar chart (if desired). To select the '''Series''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''Series''' value is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace the field the name of the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Series Value'']]<div align="center">''Set Series Value''</div><br />
#: The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
#*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
#:[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<div align="center">''Figure 30. Bar chart –Single attribute y-axis''</div><br />
#*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
#:[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<div align="center">''Figure 31. Bar chart with different series Expression''</div><br />
#* '''Finally, the Series value can be left blank if desired.'''<br />
# The next step is to provide the correct data for the chart to use. Bar charts require a '''category expression''' and a '''value expression''' where the value expression is a field to group the data by (i.e. the names of the X axis) and value expression is the value to sum. <br />
#:[[Image:iReport Chart Bar2.png|center|500px|''Category and Values'']]<div align="center">''Category and Values''</div><br />
# To select the '''category expression''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''category expression''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace field with the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Category Expression'']]<div align="center">''Set Category Expression''</div><br />
#Next, select the '''value expression''' that contains the desired numeric data for the chart. '''Note: This should always be one of the variables created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired value expression'']]<div align="center">''Select the desired value expression''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Chart Bar3.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport Chart BarPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
<br />
====Modify a Bar Chart====<br />
Once a bar chart has been created in iReport Designer, its properties can be edited by selecting the '''Chart Data''' option on the right click menu and adjusting the values and properties. <br />
<br />
To modify a bar chart:<br />
# Right click on the chart in iReport Designer and select '''Chart Data''' from the menu.<br />
# The Chart Data properties display.<br />
# To edit the main properties of the chart, select the '''Details tab'''. Additionally, this screen can be used to edit the reset type of the chart which is relevant if the chart is displayed on a band other than the summary band.<br />
# The '''Chart Details''' window displays<br />
#: [[Image:IReport Chart Bar ChartData1.png|center|500px|''Chart Data Properties'']]<div align="center">''Chart Data Properties''</div><br />
# For Bar Charts this presents the '''Category Series''' chooser. Typically there will be only one or two series to choose from here though more can be added at this point. Select the series to modify and choose '''Modify'''.<br />
# The Chart Data properties window will display<br />
#: [[Image:IReport Chart Bar ChartData2.png|center|500px|''Chart Data Properties'']]<div align="center">''Chart Data Properties''</div><br />
# In this window, the basic properties of the bar chart that were established in the Chart Wizard can be edited. These include:<br />
#*'''Series Expression''': the field used to first group data for charting purposes. To change the field, simply select another field. '''Note:''' while this field is required it can be made blank or fixed by being set to a constant such as: "" or "Blank".<br />
#*'''Category Expression''': the field used to group data for charting purposes. To change the field, simply select another field. '''Note:''' The field must be used in the creation of the variable used in the value expression or the results will be incorrect.<br />
#* '''Value Expression''': the variable used to store the data to be displayed in the chart. If changes are made this value it is recommended to edit the variable properties as well.<br />
#* '''Label Expression''': the area used to define the labels for the chart. Any valid expression can be used here. See [[Summarize i-Report Template Data#Variable Expressions|Variable Expressions]] for more details.</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11467Summarize iReport Template Data2013-09-21T23:20:04Z<p>Noah: </p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===<br />
<br />
====Add a Pie Chart====<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
====Modify a Pie Chart====<br />
Once a chart has been created in iReport Designer, its properties can be edited by selecting the '''Chart Data''' option on the right click menu and adjusting the values and properties. <br />
<br />
To modify a chart:<br />
# Right click on the chart in iReport Designer and select '''Chart Data''' from the menu.<br />
# The Chart Data properties display.<br />
#: [[Image:IReport ChartData1.png|center|500px|''Chart Data Properties'']]<div align="center">''Chart Data Properties''</div><br />
# To edit the main properties of the chart, select the '''Details tab'''. Additionally, this screen can be used to edit the reset type of the chart which is relevant if the chart is displayed on a band other than the summary band.<br />
# The '''Chart Details''' window displays<br />
#: [[Image:IReport ChartData2.png|center|500px|''Chart Data Properties'']]<div align="center">''Chart Data Properties''</div><br />
# In this window, the basic properties of the chart that were established in the Chart Wizard can be edited. These include:<br />
#* '''Key Expression''': the field used to group data for charting purposes. To change the field, simply select another field. '''Note:''' The field must be used in the creation of the variable used in the value expression or the results will be incorrect.<br />
#* '''Value Expression''': the variable used to store the data to be displayed in the chart. If changes are made this value it is recommended to edit the variable properties as well.<br />
#* '''Label Expression''': the area used to define the labels for the chart. Any valid expression can be used here. See [[Summarize i-Report Template Data#Variable Expressions|Variable Expressions]] for more details.<br />
<br />
<br />
===Bar Charts===<br />
Bar charts, unlike Pie Charts, have a third variable option that can be included in the report. In addition to the category and value expressions, bar charts add the option of a '''''series'''''. The series choice adds an additional possibility of grouping data though is not required.<br />
<br />
====Add a Bar Chart====<br />
To add a bar chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the bar chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
# Provide a '''Series Expression''' (''optional''). <br />
#:[[Image:iReport Chart Bar1.png|center|500px|''Series Expression'']]<div align="center">''Series Expression''</div><br />
# The Series Expression allows you to define an added level of detail to your bar chart (if desired). To select the '''Series''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''Series''' value is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace the field the name of the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Series Value'']]<div align="center">''Set Series Value''</div><br />
#: The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
#*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
#:[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<div align="center">''Figure 30. Bar chart –Single attribute y-axis''</div><br />
#*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
#:[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<div align="center">''Figure 31. Bar chart with different series Expression''</div><br />
#* '''Finally, the Series value can be left blank if desired.'''<br />
# The next step is to provide the correct data for the chart to use. Bar charts require a '''category expression''' and a '''value expression''' where the value expression is a field to group the data by (i.e. the names of the X axis) and value expression is the value to sum. <br />
#:[[Image:iReport Chart Bar2.png|center|500px|''Category and Values'']]<div align="center">''Category and Values''</div><br />
# To select the '''category expression''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''category expression''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace field with the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Category Expression'']]<div align="center">''Set Category Expression''</div><br />
#Next, select the '''value expression''' that contains the desired numeric data for the chart. '''Note: This should always be one of the variables created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired value expression'']]<div align="center">''Select the desired value expression''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Chart Bar3.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport Chart BarPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
<br />
===Modify Bar Charts===</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11466Summarize iReport Template Data2013-09-21T23:19:12Z<p>Noah: </p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
===Variable Expressions===<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===<br />
<br />
====Add a Pie Chart====<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
====Modify a Pie Chart====<br />
Once a chart has been created in iReport Designer, its properties can be edited by selecting the '''Chart Data''' option on the right click menu and adjusting the values and properties. <br />
<br />
To modify a chart:<br />
# Right click on the chart in iReport Designer and select '''Chart Data''' from the menu.<br />
# The Chart Data properties display.<br />
#: [[Image:IReport ChartData1.png|center|500px|''Chart Data Properties'']]<div align="center">''Chart Data Properties''</div><br />
# To edit the main properties of the chart, select the '''Details tab'''. Additionally, this screen can be used to edit the reset type of the chart which is relevant if the chart is displayed on a band other than the summary band.<br />
#: [[Image:IReport ChartData2.png|center|500px|''Chart Data Properties'']]<div align="center">''Chart Data Properties''</div><br />
<br />
===Bar Charts===<br />
Bar charts, unlike Pie Charts, have a third variable option that can be included in the report. In addition to the category and value expressions, bar charts add the option of a '''''series'''''. The series choice adds an additional possibility of grouping data though is not required.<br />
<br />
====Add a Bar Chart====<br />
To add a bar chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the bar chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
# Provide a '''Series Expression''' (''optional''). <br />
#:[[Image:iReport Chart Bar1.png|center|500px|''Series Expression'']]<div align="center">''Series Expression''</div><br />
# The Series Expression allows you to define an added level of detail to your bar chart (if desired). To select the '''Series''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''Series''' value is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace the field the name of the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Series Value'']]<div align="center">''Set Series Value''</div><br />
#: The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
#*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
#:[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<div align="center">''Figure 30. Bar chart –Single attribute y-axis''</div><br />
#*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
#:[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<div align="center">''Figure 31. Bar chart with different series Expression''</div><br />
#* '''Finally, the Series value can be left blank if desired.'''<br />
# The next step is to provide the correct data for the chart to use. Bar charts require a '''category expression''' and a '''value expression''' where the value expression is a field to group the data by (i.e. the names of the X axis) and value expression is the value to sum. <br />
#:[[Image:iReport Chart Bar2.png|center|500px|''Category and Values'']]<div align="center">''Category and Values''</div><br />
# To select the '''category expression''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''category expression''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace field with the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Category Expression'']]<div align="center">''Set Category Expression''</div><br />
#Next, select the '''value expression''' that contains the desired numeric data for the chart. '''Note: This should always be one of the variables created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired value expression'']]<div align="center">''Select the desired value expression''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Chart Bar3.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport Chart BarPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
<br />
===Modify Bar Charts===</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11463Summarize iReport Template Data2013-09-21T23:11:20Z<p>Noah: /* Modify a Pie Chart */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===<br />
<br />
====Add a Pie Chart====<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
====Modify a Pie Chart====<br />
Once a chart has been created in iReport Designer, its properties can be edited by selecting the '''Chart Data''' option on the right click menu and adjusting the values and properties. <br />
<br />
To modify a chart:<br />
# Right click on the chart in iReport Designer and select '''Chart Data''' from the menu.<br />
# The Chart Data properties display.<br />
#: [[Image:IReport ChartData1.png|center|500px|''Chart Data Properties'']]<div align="center">''Chart Data Properties''</div><br />
# To edit the main properties of the chart, select the '''Details tab'''. Additionally, this screen can be used to edit the reset type of the chart which is relevant if the chart is displayed on a band other than the summary band.<br />
#: [[Image:IReport ChartData2.png|center|500px|''Chart Data Properties'']]<div align="center">''Chart Data Properties''</div><br />
<br />
===Bar Charts===<br />
Bar charts, unlike Pie Charts, have a third variable option that can be included in the report. In addition to the category and value expressions, bar charts add the option of a '''''series'''''. The series choice adds an additional possibility of grouping data though is not required.<br />
<br />
====Add a Bar Chart====<br />
To add a bar chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the bar chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
# Provide a '''Series Expression''' (''optional''). <br />
#:[[Image:iReport Chart Bar1.png|center|500px|''Series Expression'']]<div align="center">''Series Expression''</div><br />
# The Series Expression allows you to define an added level of detail to your bar chart (if desired). To select the '''Series''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''Series''' value is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace the field the name of the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Series Value'']]<div align="center">''Set Series Value''</div><br />
#: The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
#*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
#:[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<div align="center">''Figure 30. Bar chart –Single attribute y-axis''</div><br />
#*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
#:[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<div align="center">''Figure 31. Bar chart with different series Expression''</div><br />
#* '''Finally, the Series value can be left blank if desired.'''<br />
# The next step is to provide the correct data for the chart to use. Bar charts require a '''category expression''' and a '''value expression''' where the value expression is a field to group the data by (i.e. the names of the X axis) and value expression is the value to sum. <br />
#:[[Image:iReport Chart Bar2.png|center|500px|''Category and Values'']]<div align="center">''Category and Values''</div><br />
# To select the '''category expression''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''category expression''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace field with the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Category Expression'']]<div align="center">''Set Category Expression''</div><br />
#Next, select the '''value expression''' that contains the desired numeric data for the chart. '''Note: This should always be one of the variables created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired value expression'']]<div align="center">''Select the desired value expression''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Chart Bar3.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport Chart BarPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
<br />
===Modify Bar Charts===</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_ChartData2.png&diff=11462File:IReport ChartData2.png2013-09-21T23:10:47Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_ChartData1.png&diff=11461File:IReport ChartData1.png2013-09-21T23:10:22Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11456Summarize iReport Template Data2013-09-21T22:29:11Z<p>Noah: /* Grouped Bar Chart */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===<br />
<br />
====Add a Pie Chart====<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
====Modify a Pie Chart====<br />
To modify a pie chart<br />
<br />
===Bar Charts===<br />
Bar charts, unlike Pie Charts, have a third variable option that can be included in the report. In addition to the category and value expressions, bar charts add the option of a '''''series'''''. The series choice adds an additional possibility of grouping data though is not required.<br />
<br />
====Add a Bar Chart====<br />
To add a bar chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the bar chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
# Provide a '''Series Expression''' (''optional''). <br />
#:[[Image:iReport Chart Bar1.png|center|500px|''Series Expression'']]<div align="center">''Series Expression''</div><br />
# The Series Expression allows you to define an added level of detail to your bar chart (if desired). To select the '''Series''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''Series''' value is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace the field the name of the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Series Value'']]<div align="center">''Set Series Value''</div><br />
#: The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
#*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
#:[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<div align="center">''Figure 30. Bar chart –Single attribute y-axis''</div><br />
#*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
#:[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<div align="center">''Figure 31. Bar chart with different series Expression''</div><br />
#* '''Finally, the Series value can be left blank if desired.'''<br />
# The next step is to provide the correct data for the chart to use. Bar charts require a '''category expression''' and a '''value expression''' where the value expression is a field to group the data by (i.e. the names of the X axis) and value expression is the value to sum. <br />
#:[[Image:iReport Chart Bar2.png|center|500px|''Category and Values'']]<div align="center">''Category and Values''</div><br />
# To select the '''category expression''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''category expression''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace field with the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Category Expression'']]<div align="center">''Set Category Expression''</div><br />
#Next, select the '''value expression''' that contains the desired numeric data for the chart. '''Note: This should always be one of the variables created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired value expression'']]<div align="center">''Select the desired value expression''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Chart Bar3.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport Chart BarPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
<br />
===Modify Bar Charts===</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11455Summarize iReport Template Data2013-09-21T22:28:02Z<p>Noah: /* Bar Charts */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===<br />
<br />
====Add a Pie Chart====<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
====Modify a Pie Chart====<br />
To modify a pie chart<br />
<br />
===Bar Charts===<br />
Bar charts, unlike Pie Charts, have a third variable option that can be included in the report. In addition to the category and value expressions, bar charts add the option of a '''''series'''''. The series choice adds an additional possibility of grouping data though is not required.<br />
<br />
====Add a Bar Chart====<br />
To add a bar chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the bar chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
# Provide a '''Series Expression''' (''optional''). <br />
#:[[Image:iReport Chart Bar1.png|center|500px|''Series Expression'']]<div align="center">''Series Expression''</div><br />
# The Series Expression allows you to define an added level of detail to your bar chart (if desired). To select the '''Series''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''Series''' value is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace the field the name of the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Series Value'']]<div align="center">''Set Series Value''</div><br />
#: The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
#*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
#:[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<div align="center">''Figure 30. Bar chart –Single attribute y-axis''</div><br />
#*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
#:[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<div align="center">''Figure 31. Bar chart with different series Expression''</div><br />
#* '''Finally, the Series value can be left blank if desired.'''<br />
# The next step is to provide the correct data for the chart to use. Bar charts require a '''category expression''' and a '''value expression''' where the value expression is a field to group the data by (i.e. the names of the X axis) and value expression is the value to sum. <br />
#:[[Image:iReport Chart Bar2.png|center|500px|''Category and Values'']]<div align="center">''Category and Values''</div><br />
# To select the '''category expression''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''category expression''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace field with the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Category Expression'']]<div align="center">''Set Category Expression''</div><br />
#Next, select the '''value expression''' that contains the desired numeric data for the chart. '''Note: This should always be one of the variables created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired value expression'']]<div align="center">''Select the desired value expression''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Chart Bar3.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport Chart BarPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
<br />
===Modify Bar Charts===<br />
<br />
===Grouped Bar Chart===<br />
The horizontal axis of the bar charts discussed in the previous section compared the values of a single variable. For example, the bar chart below compares the number of different activity types. <br />
<br />
[[Image:iRep34.png|center|500px|''Figure 34. Bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 34. Bar chart comparing values of a single variable''<br />
</div><br />
<br />
In this section, you will learn how to create a grouped bar chart. A grouped bar chart compares the values of a single variable in one group to the same variables in another group. In the example below, the grouped bar chart still compares the number of activity types. However, the chart also compares the number of activity types between the districts. The number of activity types (clearance, impact survey, technical survey, and road clearance) are represented by the different bar colours as indicated in the legend. The coloured bars are clustered together based on their district. The first cluster of bars shows the number of activity in the Bolikon district. The second cluster of bars shows the number of activities in the Waltern district.<br />
<br />
[[Image:iRep35.png|center|500px|''Figure 35. Grouped bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 35. Grouped bar chart comparing values of a single variable''<br />
</div><br />
<br />
The two main differences between adding a bar chart and a grouped bar chart are:<br />
*The grouped bar chart requires that you specify at least two groupings for the report. <br />
*The key expression and the category expression will differ; whereas, for a bar chart, the value for these expressions is the same. <br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a grouped bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldNameis'' the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary.</li><br />
<li>Click the '''Apply''' button.</li><br />
<li>Add a summary section to the report.</li><br />
</ol><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep36.png|center|500px|''Figure 36. Bar chart options'']]<br />
<div align="center"><br />
''Figure 36. Bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart.</li><br />
</ol><br />
<br />
[[Image:iRep37.png|center|500px|''Figure 37. Bar chart series expression'']]<br />
<div align="center"><br />
''Figure 37. Bar chart series expression''<br />
</div><br />
<br />
To enter the series expression:<br />
<ol start="15"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together.</li><br />
</ol><br />
<br />
[[Image:iRep38.png|center|500px|''Figure 38. Bar chart category expression'']]<br />
<div align="center"><br />
''Figure 38. Bar chart category expression''<br />
</div><br />
<br />
To enter the category expression:<br />
<ol start="16"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li> <br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the Save option from the '''File''' menu.</li><br />
</ol><br />
<br />
{{note|iReport requires you to save the report after adding or changing a chart.}}<br />
<br />
<ol start="20"><br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11414Summarize iReport Template Data2013-09-20T16:22:37Z<p>Noah: /* Add a Bar Chart */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===<br />
<br />
====Add a Pie Chart====<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
====Modify a Pie Chart====<br />
To modify a pie chart<br />
<br />
===Bar Charts===<br />
<br />
====Add a Bar Chart====<br />
To add a bar chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the bar chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
# Provide a '''Series Expression''' (''optional''). <br />
#:[[Image:iReport Chart Bar1.png|center|500px|''Series Expression'']]<div align="center">''Series Expression''</div><br />
# The Series Expression allows you to define an added level of detail to your bar chart (if desired). To select the '''Series''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''Series''' value is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace the field the name of the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Series Value'']]<div align="center">''Set Series Value''</div><br />
#: The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
#*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
#:[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<div align="center">''Figure 30. Bar chart –Single attribute y-axis''</div><br />
#*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
#:[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<div align="center">''Figure 31. Bar chart with different series Expression''</div><br />
#* '''Finally, the Series value can be left blank if desired.'''<br />
# The next step is to provide the correct data for the chart to use. Bar charts require a '''category expression''' and a '''value expression''' where the value expression is a field to group the data by (i.e. the names of the X axis) and value expression is the value to sum. <br />
#:[[Image:iReport Chart Bar2.png|center|500px|''Category and Values'']]<div align="center">''Category and Values''</div><br />
# To select the '''category expression''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''category expression''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace field with the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Category Expression'']]<div align="center">''Set Category Expression''</div><br />
#Next, select the '''value expression''' that contains the desired numeric data for the chart. '''Note: This should always be one of the variables created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired value expression'']]<div align="center">''Select the desired value expression''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Chart Bar3.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport Chart BarPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
<br />
===Modify Bar Charts===<br />
<br />
===Grouped Bar Chart===<br />
The horizontal axis of the bar charts discussed in the previous section compared the values of a single variable. For example, the bar chart below compares the number of different activity types. <br />
<br />
[[Image:iRep34.png|center|500px|''Figure 34. Bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 34. Bar chart comparing values of a single variable''<br />
</div><br />
<br />
In this section, you will learn how to create a grouped bar chart. A grouped bar chart compares the values of a single variable in one group to the same variables in another group. In the example below, the grouped bar chart still compares the number of activity types. However, the chart also compares the number of activity types between the districts. The number of activity types (clearance, impact survey, technical survey, and road clearance) are represented by the different bar colours as indicated in the legend. The coloured bars are clustered together based on their district. The first cluster of bars shows the number of activity in the Bolikon district. The second cluster of bars shows the number of activities in the Waltern district.<br />
<br />
[[Image:iRep35.png|center|500px|''Figure 35. Grouped bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 35. Grouped bar chart comparing values of a single variable''<br />
</div><br />
<br />
The two main differences between adding a bar chart and a grouped bar chart are:<br />
*The grouped bar chart requires that you specify at least two groupings for the report. <br />
*The key expression and the category expression will differ; whereas, for a bar chart, the value for these expressions is the same. <br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a grouped bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldNameis'' the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary.</li><br />
<li>Click the '''Apply''' button.</li><br />
<li>Add a summary section to the report.</li><br />
</ol><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep36.png|center|500px|''Figure 36. Bar chart options'']]<br />
<div align="center"><br />
''Figure 36. Bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart.</li><br />
</ol><br />
<br />
[[Image:iRep37.png|center|500px|''Figure 37. Bar chart series expression'']]<br />
<div align="center"><br />
''Figure 37. Bar chart series expression''<br />
</div><br />
<br />
To enter the series expression:<br />
<ol start="15"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together.</li><br />
</ol><br />
<br />
[[Image:iRep38.png|center|500px|''Figure 38. Bar chart category expression'']]<br />
<div align="center"><br />
''Figure 38. Bar chart category expression''<br />
</div><br />
<br />
To enter the category expression:<br />
<ol start="16"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li> <br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the Save option from the '''File''' menu.</li><br />
</ol><br />
<br />
{{note|iReport requires you to save the report after adding or changing a chart.}}<br />
<br />
<ol start="20"><br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11413Summarize iReport Template Data2013-09-20T16:10:19Z<p>Noah: /* Add a Bar Chart */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===<br />
<br />
====Add a Pie Chart====<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
====Modify a Pie Chart====<br />
To modify a pie chart<br />
<br />
===Bar Charts===<br />
<br />
====Add a Bar Chart====<br />
To add a bar chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the bar chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
# Provide a '''Series Expression''' (''optional''). <br />
#:[[Image:iReport Chart Bar1.png|center|500px|''Series Expression'']]<div align="center">''Series Expression''</div><br />
# The Series Expression allows you to define an added level of detail to your bar chart (if desired). To select the '''Series''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''Series''' value is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace the field the name of the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Series Value'']]<div align="center">''Set Series Value''</div><br />
#: The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
#*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
#:[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<div align="center">''Figure 30. Bar chart –Single attribute y-axis''</div><br />
#*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
#:[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<div align="center">''Figure 31. Bar chart with different series Expression''</div><br />
# The next step is to provide the correct data for the chart to use. Bar charts require a '''cstegory expression''' and a '''value expression''' where the value expression is a field to group the data by (i.e. the names of the X axis) and value expression is the value to sum. <br />
#:[[Image:iReport Chart Bar2.png|center|500px|''Category and Values'']]<div align="center">''Category and Values''</div><br />
# To select the '''category expression''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''category expression''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace field with the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Category Expression'']]<div align="center">''Set Category Expression''</div><br />
#Next, select the '''value expression''' that contains the desired numeric data for the chart. '''Note: This should always be one of the variables created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired value expression'']]<div align="center">''Select the desired value expression''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Chart Bar3.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport Chart BarPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
<br />
===Modify Bar Charts===<br />
<br />
===Grouped Bar Chart===<br />
The horizontal axis of the bar charts discussed in the previous section compared the values of a single variable. For example, the bar chart below compares the number of different activity types. <br />
<br />
[[Image:iRep34.png|center|500px|''Figure 34. Bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 34. Bar chart comparing values of a single variable''<br />
</div><br />
<br />
In this section, you will learn how to create a grouped bar chart. A grouped bar chart compares the values of a single variable in one group to the same variables in another group. In the example below, the grouped bar chart still compares the number of activity types. However, the chart also compares the number of activity types between the districts. The number of activity types (clearance, impact survey, technical survey, and road clearance) are represented by the different bar colours as indicated in the legend. The coloured bars are clustered together based on their district. The first cluster of bars shows the number of activity in the Bolikon district. The second cluster of bars shows the number of activities in the Waltern district.<br />
<br />
[[Image:iRep35.png|center|500px|''Figure 35. Grouped bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 35. Grouped bar chart comparing values of a single variable''<br />
</div><br />
<br />
The two main differences between adding a bar chart and a grouped bar chart are:<br />
*The grouped bar chart requires that you specify at least two groupings for the report. <br />
*The key expression and the category expression will differ; whereas, for a bar chart, the value for these expressions is the same. <br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a grouped bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldNameis'' the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary.</li><br />
<li>Click the '''Apply''' button.</li><br />
<li>Add a summary section to the report.</li><br />
</ol><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep36.png|center|500px|''Figure 36. Bar chart options'']]<br />
<div align="center"><br />
''Figure 36. Bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart.</li><br />
</ol><br />
<br />
[[Image:iRep37.png|center|500px|''Figure 37. Bar chart series expression'']]<br />
<div align="center"><br />
''Figure 37. Bar chart series expression''<br />
</div><br />
<br />
To enter the series expression:<br />
<ol start="15"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together.</li><br />
</ol><br />
<br />
[[Image:iRep38.png|center|500px|''Figure 38. Bar chart category expression'']]<br />
<div align="center"><br />
''Figure 38. Bar chart category expression''<br />
</div><br />
<br />
To enter the category expression:<br />
<ol start="16"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li> <br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the Save option from the '''File''' menu.</li><br />
</ol><br />
<br />
{{note|iReport requires you to save the report after adding or changing a chart.}}<br />
<br />
<ol start="20"><br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11412Summarize iReport Template Data2013-09-20T16:09:06Z<p>Noah: </p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===<br />
<br />
====Add a Pie Chart====<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
====Modify a Pie Chart====<br />
To modify a pie chart<br />
<br />
===Bar Charts===<br />
<br />
====Add a Bar Chart====<br />
To add a bar chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the bar chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
# Provide a '''Series Expression''' (''optional''). <br />
#:[[Image:iReport Chart Bar1.png|center|500px|''Series Expression'']]<div align="center">''Series Expression''</div><br />
# The Series Expression allows you to define an added level of detail to your bar chart (if desired). To select the '''Series''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''Series''' value is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace the field the name of the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Series Value'']]<div align="center">''Set Series Value''</div><br />
#: The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
#*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
#:[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<div align="center">''Figure 30. Bar chart –Single attribute y-axis''</div><br />
#*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
#:[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<div align="center">''Figure 31. Bar chart with different series Expression''</div><br />
# The next step is to provide the correct data for the chart to use. Bar charts require a '''cstegory expression''' and a '''value expression''' where the value expression is a field to group the data by (i.e. the names of the X axis) and value expression is the value to sum. <br />
#:[[Image:iReport Chart Bar2.png|center|500px|''Category and Values'']]<div align="center">''Category and Values''</div><br />
# To select the '''category expression''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''category expression''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace field with the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Category Expression'']]<div align="center">''Set Category Expression''</div><br />
#Next, select the '''value expression''' that contains the desired numeric data for the chart. '''Note: This should always be one of the variables created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired value expression'']]<div align="center">''Select the desired value expression''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Chart Bar3.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport Chart BarPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
<br />
===Modify Bar Charts===<br />
<br />
===Grouped Bar Chart===<br />
The horizontal axis of the bar charts discussed in the previous section compared the values of a single variable. For example, the bar chart below compares the number of different activity types. <br />
<br />
[[Image:iRep34.png|center|500px|''Figure 34. Bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 34. Bar chart comparing values of a single variable''<br />
</div><br />
<br />
In this section, you will learn how to create a grouped bar chart. A grouped bar chart compares the values of a single variable in one group to the same variables in another group. In the example below, the grouped bar chart still compares the number of activity types. However, the chart also compares the number of activity types between the districts. The number of activity types (clearance, impact survey, technical survey, and road clearance) are represented by the different bar colours as indicated in the legend. The coloured bars are clustered together based on their district. The first cluster of bars shows the number of activity in the Bolikon district. The second cluster of bars shows the number of activities in the Waltern district.<br />
<br />
[[Image:iRep35.png|center|500px|''Figure 35. Grouped bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 35. Grouped bar chart comparing values of a single variable''<br />
</div><br />
<br />
The two main differences between adding a bar chart and a grouped bar chart are:<br />
*The grouped bar chart requires that you specify at least two groupings for the report. <br />
*The key expression and the category expression will differ; whereas, for a bar chart, the value for these expressions is the same. <br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a grouped bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldNameis'' the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary.</li><br />
<li>Click the '''Apply''' button.</li><br />
<li>Add a summary section to the report.</li><br />
</ol><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep36.png|center|500px|''Figure 36. Bar chart options'']]<br />
<div align="center"><br />
''Figure 36. Bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart.</li><br />
</ol><br />
<br />
[[Image:iRep37.png|center|500px|''Figure 37. Bar chart series expression'']]<br />
<div align="center"><br />
''Figure 37. Bar chart series expression''<br />
</div><br />
<br />
To enter the series expression:<br />
<ol start="15"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together.</li><br />
</ol><br />
<br />
[[Image:iRep38.png|center|500px|''Figure 38. Bar chart category expression'']]<br />
<div align="center"><br />
''Figure 38. Bar chart category expression''<br />
</div><br />
<br />
To enter the category expression:<br />
<ol start="16"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li> <br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the Save option from the '''File''' menu.</li><br />
</ol><br />
<br />
{{note|iReport requires you to save the report after adding or changing a chart.}}<br />
<br />
<ol start="20"><br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Chart_BarPreview.png&diff=11410File:IReport Chart BarPreview.png2013-09-20T16:06:59Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11409Summarize iReport Template Data2013-09-20T16:05:19Z<p>Noah: /* Charts */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===<br />
<br />
====Add a Pie Chart====<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
====Modify a Pie Chart====<br />
To modify a pie chart<br />
<br />
===Bar Charts===<br />
<br />
====Add a Bar Chart====<br />
To add a bar chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the bar chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
# Provide a '''Series Expression''' (''optional''). <br />
#:[[Image:iReport Chart Bar1.png|center|500px|''Series Expression'']]<div align="center">''Series Expression''</div><br />
# The Series Expression allows you to define an added level of detail to your bar chart (if desired). To select the '''Series''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''Series''' value is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace the field the name of the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Series Value'']]<div align="center">''Set Series Value''</div><br />
#: The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
#*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
#:[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<div align="center">''Figure 30. Bar chart –Single attribute y-axis''</div><br />
#*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
#:[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<div align="center">''Figure 31. Bar chart with different series Expression''</div><br />
# The next step is to provide the correct data for the chart to use. Bar charts require a '''cstegory expression''' and a '''value expression''' where the value expression is a field to group the data by (i.e. the names of the X axis) and value expression is the value to sum. <br />
#:[[Image:iReport Chart Bar2.png|center|500px|''Category and Values'']]<div align="center">''Category and Values''</div><br />
# To select the '''category expression''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''category expression''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace field with the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Category Expression'']]<div align="center">''Set Category Expression''</div><br />
#Next, select the '''value expression''' that contains the desired numeric data for the chart. '''Note: This should always be one of the variables created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired value expression'']]<div align="center">''Select the desired value expression''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Chart Bar3.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport Chart BarPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
<br />
===OLD===<br />
<li>Right-click anywhere on the chart.</li><br />
<li>Select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>The Series Expression allows you to define an added level of detail to your bar chart. To enter the series expression value:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li><br />
$F{''attribute''} '''!= null ? $F{attribute} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
</ol><br />
<br />
[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<br />
<div align="center"><br />
''Figure 30. Bar chart –Single attribute y-axis''<br />
</div><br />
<br />
<ol><br />
*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
</ol><br />
<br />
[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<br />
<div align="center"><br />
''Figure 31. Bar chart with different series expression''<br />
</div><br />
<br />
<ol><br />
The Chart Properties window for this bar chart is shown below. Notice that the series expression and category expression differ.<br />
</ol><br />
<br />
[[Image:iRep32.png|center|500px|''Figure 32. Chart Properties – Different series and category expressions'']]<br />
<div align="center"><br />
''Figure 32. Chart Properties – Different series and category expressions''<br />
</div><br />
<br />
<ol><br />
*If you selected one of the stacked bar chart options, the series expression will be used to determine the segments of each bar. In the following figure, the series expression creates red and blue segments in each bar to indicate whether or not water access is blocked.<br />
</ol><br />
<br />
[[Image:iRep33.png|center|500px|''Figure 33. Stacked bar chart'']]<br />
<div align="center"><br />
''Figure 33. Stacked bar chart''<br />
</div><br />
<br />
<ol start="14"><br />
<li>The Category Expression is the major grouping of the horizontal axis. To enter the category expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li><br />
$F{''attribute''} '''!= null ? $F{attribute} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the expression that returns the numeric value for the key.</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that was created to store the total.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the '''Save''' option from the '''File''' menu.</li><br />
</ol><br />
<br />
===Grouped Bar Chart===__NOEDITSECTION__<br />
The horizontal axis of the bar charts discussed in the previous section compared the values of a single variable. For example, the bar chart below compares the number of different activity types. <br />
<br />
[[Image:iRep34.png|center|500px|''Figure 34. Bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 34. Bar chart comparing values of a single variable''<br />
</div><br />
<br />
In this section, you will learn how to create a grouped bar chart. A grouped bar chart compares the values of a single variable in one group to the same variables in another group. In the example below, the grouped bar chart still compares the number of activity types. However, the chart also compares the number of activity types between the districts. The number of activity types (clearance, impact survey, technical survey, and road clearance) are represented by the different bar colours as indicated in the legend. The coloured bars are clustered together based on their district. The first cluster of bars shows the number of activity in the Bolikon district. The second cluster of bars shows the number of activities in the Waltern district.<br />
<br />
[[Image:iRep35.png|center|500px|''Figure 35. Grouped bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 35. Grouped bar chart comparing values of a single variable''<br />
</div><br />
<br />
The two main differences between adding a bar chart and a grouped bar chart are:<br />
*The grouped bar chart requires that you specify at least two groupings for the report. <br />
*The key expression and the category expression will differ; whereas, for a bar chart, the value for these expressions is the same. <br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a grouped bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldNameis'' the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary.</li><br />
<li>Click the '''Apply''' button.</li><br />
<li>Add a summary section to the report.</li><br />
</ol><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep36.png|center|500px|''Figure 36. Bar chart options'']]<br />
<div align="center"><br />
''Figure 36. Bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart.</li><br />
</ol><br />
<br />
[[Image:iRep37.png|center|500px|''Figure 37. Bar chart series expression'']]<br />
<div align="center"><br />
''Figure 37. Bar chart series expression''<br />
</div><br />
<br />
To enter the series expression:<br />
<ol start="15"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together.</li><br />
</ol><br />
<br />
[[Image:iRep38.png|center|500px|''Figure 38. Bar chart category expression'']]<br />
<div align="center"><br />
''Figure 38. Bar chart category expression''<br />
</div><br />
<br />
To enter the category expression:<br />
<ol start="16"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li> <br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the Save option from the '''File''' menu.</li><br />
</ol><br />
<br />
{{note|iReport requires you to save the report after adding or changing a chart.}}<br />
<br />
<ol start="20"><br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Chart_Bar1.png&diff=11407File:IReport Chart Bar1.png2013-09-20T15:59:42Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11405Summarize iReport Template Data2013-09-20T15:54:16Z<p>Noah: /* Charts */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===<br />
<br />
====Add a Pie Chart====<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
====Modify a Pie Chart====<br />
To modify a pie chart<br />
<br />
===Bar Charts===<br />
<br />
====Add a Bar Chart====<br />
To add a bar chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the bar chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
# Provide a '''Series Expression''' (''optional''). <br />
#:[[Image:iReport Charts2.png|center|500px|''Series Expression'']]<div align="center">''Series Expression''</div><br />
# The Series Expression allows you to define an added level of detail to your bar chart (if desired). To select the '''Series''' choose the '''Expression editor''' button and '''choose one of the ''fields'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''Series''' value is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace the field the name of the field that you selected above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Series Value'']]<div align="center">''Set Series Value''</div><br />
#: The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
#*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
#:[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<div align="center">''Figure 30. Bar chart –Single attribute y-axis''</div><br />
#*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
#:[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<div align="center">''Figure 31. Bar chart with different series Expression''</div><br />
<br />
<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Bar charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
<br />
<br />
<li>Right-click anywhere on the chart.</li><br />
<li>Select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>The Series Expression allows you to define an added level of detail to your bar chart. To enter the series expression value:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li><br />
$F{''attribute''} '''!= null ? $F{attribute} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
</ol><br />
<br />
[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<br />
<div align="center"><br />
''Figure 30. Bar chart –Single attribute y-axis''<br />
</div><br />
<br />
<ol><br />
*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
</ol><br />
<br />
[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<br />
<div align="center"><br />
''Figure 31. Bar chart with different series expression''<br />
</div><br />
<br />
<ol><br />
The Chart Properties window for this bar chart is shown below. Notice that the series expression and category expression differ.<br />
</ol><br />
<br />
[[Image:iRep32.png|center|500px|''Figure 32. Chart Properties – Different series and category expressions'']]<br />
<div align="center"><br />
''Figure 32. Chart Properties – Different series and category expressions''<br />
</div><br />
<br />
<ol><br />
*If you selected one of the stacked bar chart options, the series expression will be used to determine the segments of each bar. In the following figure, the series expression creates red and blue segments in each bar to indicate whether or not water access is blocked.<br />
</ol><br />
<br />
[[Image:iRep33.png|center|500px|''Figure 33. Stacked bar chart'']]<br />
<div align="center"><br />
''Figure 33. Stacked bar chart''<br />
</div><br />
<br />
<ol start="14"><br />
<li>The Category Expression is the major grouping of the horizontal axis. To enter the category expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li><br />
$F{''attribute''} '''!= null ? $F{attribute} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the expression that returns the numeric value for the key.</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that was created to store the total.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the '''Save''' option from the '''File''' menu.</li><br />
</ol><br />
<br />
===Grouped Bar Chart===__NOEDITSECTION__<br />
The horizontal axis of the bar charts discussed in the previous section compared the values of a single variable. For example, the bar chart below compares the number of different activity types. <br />
<br />
[[Image:iRep34.png|center|500px|''Figure 34. Bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 34. Bar chart comparing values of a single variable''<br />
</div><br />
<br />
In this section, you will learn how to create a grouped bar chart. A grouped bar chart compares the values of a single variable in one group to the same variables in another group. In the example below, the grouped bar chart still compares the number of activity types. However, the chart also compares the number of activity types between the districts. The number of activity types (clearance, impact survey, technical survey, and road clearance) are represented by the different bar colours as indicated in the legend. The coloured bars are clustered together based on their district. The first cluster of bars shows the number of activity in the Bolikon district. The second cluster of bars shows the number of activities in the Waltern district.<br />
<br />
[[Image:iRep35.png|center|500px|''Figure 35. Grouped bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 35. Grouped bar chart comparing values of a single variable''<br />
</div><br />
<br />
The two main differences between adding a bar chart and a grouped bar chart are:<br />
*The grouped bar chart requires that you specify at least two groupings for the report. <br />
*The key expression and the category expression will differ; whereas, for a bar chart, the value for these expressions is the same. <br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a grouped bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldNameis'' the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary.</li><br />
<li>Click the '''Apply''' button.</li><br />
<li>Add a summary section to the report.</li><br />
</ol><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep36.png|center|500px|''Figure 36. Bar chart options'']]<br />
<div align="center"><br />
''Figure 36. Bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart.</li><br />
</ol><br />
<br />
[[Image:iRep37.png|center|500px|''Figure 37. Bar chart series expression'']]<br />
<div align="center"><br />
''Figure 37. Bar chart series expression''<br />
</div><br />
<br />
To enter the series expression:<br />
<ol start="15"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together.</li><br />
</ol><br />
<br />
[[Image:iRep38.png|center|500px|''Figure 38. Bar chart category expression'']]<br />
<div align="center"><br />
''Figure 38. Bar chart category expression''<br />
</div><br />
<br />
To enter the category expression:<br />
<ol start="16"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li> <br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the Save option from the '''File''' menu.</li><br />
</ol><br />
<br />
{{note|iReport requires you to save the report after adding or changing a chart.}}<br />
<br />
<ol start="20"><br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Chart_Bar3.png&diff=11404File:IReport Chart Bar3.png2013-09-20T15:52:19Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Chart_Bar2.png&diff=11403File:IReport Chart Bar2.png2013-09-20T15:52:00Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Chart_Bar_ChartData2.png&diff=11402File:IReport Chart Bar ChartData2.png2013-09-20T15:51:42Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Chart_Bar_ChartData1.png&diff=11401File:IReport Chart Bar ChartData1.png2013-09-20T15:51:27Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11397Summarize iReport Template Data2013-09-20T15:20:11Z<p>Noah: </p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===<br />
<br />
====Add a Pie Chart====<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
====Modify a Pie Chart====<br />
To modify a pie chart<br />
<br />
===Bar Charts===<br />
<br />
====Add a Bar Chart====<br />
To add a bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the attribute on which you would like to base your chart.</li><br />
<li>After creating the report, you should add a footer for the attribute on which the results will be grouped. This footer will be used to display the total for the group that will subsequently be used in the pie chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <'''GroupAttribute'''>Footer from the left pane where ''GroupAttribute'' is the name of the attribute on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Add a summary section to the report.</li><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>Select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>The Series Expression allows you to define an added level of detail to your bar chart. To enter the series expression value:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li><br />
$F{''attribute''} '''!= null ? $F{attribute} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
</ol><br />
<br />
[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<br />
<div align="center"><br />
''Figure 30. Bar chart –Single attribute y-axis''<br />
</div><br />
<br />
<ol><br />
*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
</ol><br />
<br />
[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<br />
<div align="center"><br />
''Figure 31. Bar chart with different series expression''<br />
</div><br />
<br />
<ol><br />
The Chart Properties window for this bar chart is shown below. Notice that the series expression and category expression differ.<br />
</ol><br />
<br />
[[Image:iRep32.png|center|500px|''Figure 32. Chart Properties – Different series and category expressions'']]<br />
<div align="center"><br />
''Figure 32. Chart Properties – Different series and category expressions''<br />
</div><br />
<br />
<ol><br />
*If you selected one of the stacked bar chart options, the series expression will be used to determine the segments of each bar. In the following figure, the series expression creates red and blue segments in each bar to indicate whether or not water access is blocked.<br />
</ol><br />
<br />
[[Image:iRep33.png|center|500px|''Figure 33. Stacked bar chart'']]<br />
<div align="center"><br />
''Figure 33. Stacked bar chart''<br />
</div><br />
<br />
<ol start="14"><br />
<li>The Category Expression is the major grouping of the horizontal axis. To enter the category expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li><br />
$F{''attribute''} '''!= null ? $F{attribute} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the expression that returns the numeric value for the key.</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that was created to store the total.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the '''Save''' option from the '''File''' menu.</li><br />
</ol><br />
<br />
===Grouped Bar Chart===__NOEDITSECTION__<br />
The horizontal axis of the bar charts discussed in the previous section compared the values of a single variable. For example, the bar chart below compares the number of different activity types. <br />
<br />
[[Image:iRep34.png|center|500px|''Figure 34. Bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 34. Bar chart comparing values of a single variable''<br />
</div><br />
<br />
In this section, you will learn how to create a grouped bar chart. A grouped bar chart compares the values of a single variable in one group to the same variables in another group. In the example below, the grouped bar chart still compares the number of activity types. However, the chart also compares the number of activity types between the districts. The number of activity types (clearance, impact survey, technical survey, and road clearance) are represented by the different bar colours as indicated in the legend. The coloured bars are clustered together based on their district. The first cluster of bars shows the number of activity in the Bolikon district. The second cluster of bars shows the number of activities in the Waltern district.<br />
<br />
[[Image:iRep35.png|center|500px|''Figure 35. Grouped bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 35. Grouped bar chart comparing values of a single variable''<br />
</div><br />
<br />
The two main differences between adding a bar chart and a grouped bar chart are:<br />
*The grouped bar chart requires that you specify at least two groupings for the report. <br />
*The key expression and the category expression will differ; whereas, for a bar chart, the value for these expressions is the same. <br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a grouped bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldNameis'' the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary.</li><br />
<li>Click the '''Apply''' button.</li><br />
<li>Add a summary section to the report.</li><br />
</ol><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep36.png|center|500px|''Figure 36. Bar chart options'']]<br />
<div align="center"><br />
''Figure 36. Bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart.</li><br />
</ol><br />
<br />
[[Image:iRep37.png|center|500px|''Figure 37. Bar chart series expression'']]<br />
<div align="center"><br />
''Figure 37. Bar chart series expression''<br />
</div><br />
<br />
To enter the series expression:<br />
<ol start="15"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together.</li><br />
</ol><br />
<br />
[[Image:iRep38.png|center|500px|''Figure 38. Bar chart category expression'']]<br />
<div align="center"><br />
''Figure 38. Bar chart category expression''<br />
</div><br />
<br />
To enter the category expression:<br />
<ol start="16"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li> <br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the Save option from the '''File''' menu.</li><br />
</ol><br />
<br />
{{note|iReport requires you to save the report after adding or changing a chart.}}<br />
<br />
<ol start="20"><br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11395Summarize iReport Template Data2013-09-20T15:16:58Z<p>Noah: /* Charts */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===<br />
<br />
====Add a Pie Chart====<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
====Modify a Pie Chart====<br />
To modify a pie chart<br />
<br />
===Bar Charts===<br />
<br />
====Add a Bar Chart====<br />
To add a bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the attribute on which you would like to base your chart.</li><br />
<li>After creating the report, you should add a footer for the attribute on which the results will be grouped. This footer will be used to display the total for the group that will subsequently be used in the pie chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <'''GroupAttribute'''>Footer from the left pane where ''GroupAttribute'' is the name of the attribute on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Add a summary section to the report.</li><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>Select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>The Series Expression allows you to define an added level of detail to your bar chart. To enter the series expression value:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li><br />
$F{''attribute''} '''!= null ? $F{attribute} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
</ol><br />
<br />
[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<br />
<div align="center"><br />
''Figure 30. Bar chart –Single attribute y-axis''<br />
</div><br />
<br />
<ol><br />
*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
</ol><br />
<br />
[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<br />
<div align="center"><br />
''Figure 31. Bar chart with different series expression''<br />
</div><br />
<br />
<ol><br />
The Chart Properties window for this bar chart is shown below. Notice that the series expression and category expression differ.<br />
</ol><br />
<br />
[[Image:iRep32.png|center|500px|''Figure 32. Chart Properties – Different series and category expressions'']]<br />
<div align="center"><br />
''Figure 32. Chart Properties – Different series and category expressions''<br />
</div><br />
<br />
<ol><br />
*If you selected one of the stacked bar chart options, the series expression will be used to determine the segments of each bar. In the following figure, the series expression creates red and blue segments in each bar to indicate whether or not water access is blocked.<br />
</ol><br />
<br />
[[Image:iRep33.png|center|500px|''Figure 33. Stacked bar chart'']]<br />
<div align="center"><br />
''Figure 33. Stacked bar chart''<br />
</div><br />
<br />
<ol start="14"><br />
<li>The Category Expression is the major grouping of the horizontal axis. To enter the category expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li><br />
$F{''attribute''} '''!= null ? $F{attribute} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the expression that returns the numeric value for the key.</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that was created to store the total.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the '''Save''' option from the '''File''' menu.</li><br />
</ol><br />
<br />
===Grouped Bar Chart===__NOEDITSECTION__<br />
The horizontal axis of the bar charts discussed in the previous section compared the values of a single variable. For example, the bar chart below compares the number of different activity types. <br />
<br />
[[Image:iRep34.png|center|500px|''Figure 34. Bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 34. Bar chart comparing values of a single variable''<br />
</div><br />
<br />
In this section, you will learn how to create a grouped bar chart. A grouped bar chart compares the values of a single variable in one group to the same variables in another group. In the example below, the grouped bar chart still compares the number of activity types. However, the chart also compares the number of activity types between the districts. The number of activity types (clearance, impact survey, technical survey, and road clearance) are represented by the different bar colours as indicated in the legend. The coloured bars are clustered together based on their district. The first cluster of bars shows the number of activity in the Bolikon district. The second cluster of bars shows the number of activities in the Waltern district.<br />
<br />
[[Image:iRep35.png|center|500px|''Figure 35. Grouped bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 35. Grouped bar chart comparing values of a single variable''<br />
</div><br />
<br />
The two main differences between adding a bar chart and a grouped bar chart are:<br />
*The grouped bar chart requires that you specify at least two groupings for the report. <br />
*The key expression and the category expression will differ; whereas, for a bar chart, the value for these expressions is the same. <br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a grouped bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldNameis'' the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary.</li><br />
<li>Click the '''Apply''' button.</li><br />
<li>Add a summary section to the report.</li><br />
</ol><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep36.png|center|500px|''Figure 36. Bar chart options'']]<br />
<div align="center"><br />
''Figure 36. Bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart.</li><br />
</ol><br />
<br />
[[Image:iRep37.png|center|500px|''Figure 37. Bar chart series expression'']]<br />
<div align="center"><br />
''Figure 37. Bar chart series expression''<br />
</div><br />
<br />
To enter the series expression:<br />
<ol start="15"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together.</li><br />
</ol><br />
<br />
[[Image:iRep38.png|center|500px|''Figure 38. Bar chart category expression'']]<br />
<div align="center"><br />
''Figure 38. Bar chart category expression''<br />
</div><br />
<br />
To enter the category expression:<br />
<ol start="16"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li> <br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the Save option from the '''File''' menu.</li><br />
</ol><br />
<br />
{{note|iReport requires you to save the report after adding or changing a chart.}}<br />
<br />
<ol start="20"><br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
===Stacked Bar Chart===__NOEDITSECTION__<br />
A stacked bar chart is similar to a grouped bar in that it allows you to represent two different fields on the chart. The key difference is that the stacked bar chart layers the values of the series expression (the field represented in the legend) allowing you to easily compare the categories to one another. <br />
<br />
[[Image:iRep39.png|center|500px|''Figure 39. Stacked bar chart'']]<br />
<div align="center"><br />
''Figure 39. Stacked bar chart''<br />
</div><br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a stacked bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldName'' is the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li> <br />
<li>In the right pane, enter a numeric value in the '''Band Height''' field. You may adjust the height of the summary</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Add a summary section to the report.</li><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the stacked bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep40.png|center|500px|''Figure 40. Stacked bar chart options'']]<br />
<div align="center"><br />
''Figure 40. Stacked bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>Select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li.<br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a stacked bar chart, the series expression contains the fields whose distinct value.</li> <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart. To enter the series expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.<br />
:The Expression editor window displays.</li><br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together. To enter the category expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</vli><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
The expression to represent the field displays in the top pane.<br />
<li>Click the Apply button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the '''Save''' option from the '''File''' menu.</li> <br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11394Summarize iReport Template Data2013-09-20T15:15:24Z<p>Noah: /* Charts */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===__NOEDITSECTION__<br />
<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Chart Wizard Completed'']]<div align="center">''Chart Wizard Completed''</div><br />
# Choose '''Finish''' and the iReport template displays with the Chart.<br />
#:[[Image:iReport Charts8.png|center|500px|''iReport displays with Chart'']]<div align="center">''iReport displays with Chart''</div><br />
# The report can now be previewed to ensure it is functioning as expected.<br />
#:[[Image:iReport ChartsPreview.png|center|500px|''Preview with Chart'']]<div align="center">''Preview with chart''</div><br />
===Modify a Pie Chart===<br />
To modify a pie chart<br />
<br />
===Bar Charts===<br />
<br />
To add a bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the attribute on which you would like to base your chart.</li><br />
<li>After creating the report, you should add a footer for the attribute on which the results will be grouped. This footer will be used to display the total for the group that will subsequently be used in the pie chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <'''GroupAttribute'''>Footer from the left pane where ''GroupAttribute'' is the name of the attribute on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Add a summary section to the report.</li><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>Select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>The Series Expression allows you to define an added level of detail to your bar chart. To enter the series expression value:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li><br />
$F{''attribute''} '''!= null ? $F{attribute} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
</ol><br />
<br />
[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<br />
<div align="center"><br />
''Figure 30. Bar chart –Single attribute y-axis''<br />
</div><br />
<br />
<ol><br />
*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
</ol><br />
<br />
[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<br />
<div align="center"><br />
''Figure 31. Bar chart with different series expression''<br />
</div><br />
<br />
<ol><br />
The Chart Properties window for this bar chart is shown below. Notice that the series expression and category expression differ.<br />
</ol><br />
<br />
[[Image:iRep32.png|center|500px|''Figure 32. Chart Properties – Different series and category expressions'']]<br />
<div align="center"><br />
''Figure 32. Chart Properties – Different series and category expressions''<br />
</div><br />
<br />
<ol><br />
*If you selected one of the stacked bar chart options, the series expression will be used to determine the segments of each bar. In the following figure, the series expression creates red and blue segments in each bar to indicate whether or not water access is blocked.<br />
</ol><br />
<br />
[[Image:iRep33.png|center|500px|''Figure 33. Stacked bar chart'']]<br />
<div align="center"><br />
''Figure 33. Stacked bar chart''<br />
</div><br />
<br />
<ol start="14"><br />
<li>The Category Expression is the major grouping of the horizontal axis. To enter the category expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li><br />
$F{''attribute''} '''!= null ? $F{attribute} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the expression that returns the numeric value for the key.</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that was created to store the total.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the '''Save''' option from the '''File''' menu.</li><br />
</ol><br />
<br />
===Grouped Bar Chart===__NOEDITSECTION__<br />
The horizontal axis of the bar charts discussed in the previous section compared the values of a single variable. For example, the bar chart below compares the number of different activity types. <br />
<br />
[[Image:iRep34.png|center|500px|''Figure 34. Bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 34. Bar chart comparing values of a single variable''<br />
</div><br />
<br />
In this section, you will learn how to create a grouped bar chart. A grouped bar chart compares the values of a single variable in one group to the same variables in another group. In the example below, the grouped bar chart still compares the number of activity types. However, the chart also compares the number of activity types between the districts. The number of activity types (clearance, impact survey, technical survey, and road clearance) are represented by the different bar colours as indicated in the legend. The coloured bars are clustered together based on their district. The first cluster of bars shows the number of activity in the Bolikon district. The second cluster of bars shows the number of activities in the Waltern district.<br />
<br />
[[Image:iRep35.png|center|500px|''Figure 35. Grouped bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 35. Grouped bar chart comparing values of a single variable''<br />
</div><br />
<br />
The two main differences between adding a bar chart and a grouped bar chart are:<br />
*The grouped bar chart requires that you specify at least two groupings for the report. <br />
*The key expression and the category expression will differ; whereas, for a bar chart, the value for these expressions is the same. <br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a grouped bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldNameis'' the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary.</li><br />
<li>Click the '''Apply''' button.</li><br />
<li>Add a summary section to the report.</li><br />
</ol><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep36.png|center|500px|''Figure 36. Bar chart options'']]<br />
<div align="center"><br />
''Figure 36. Bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart.</li><br />
</ol><br />
<br />
[[Image:iRep37.png|center|500px|''Figure 37. Bar chart series expression'']]<br />
<div align="center"><br />
''Figure 37. Bar chart series expression''<br />
</div><br />
<br />
To enter the series expression:<br />
<ol start="15"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together.</li><br />
</ol><br />
<br />
[[Image:iRep38.png|center|500px|''Figure 38. Bar chart category expression'']]<br />
<div align="center"><br />
''Figure 38. Bar chart category expression''<br />
</div><br />
<br />
To enter the category expression:<br />
<ol start="16"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li> <br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the Save option from the '''File''' menu.</li><br />
</ol><br />
<br />
{{note|iReport requires you to save the report after adding or changing a chart.}}<br />
<br />
<ol start="20"><br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
===Stacked Bar Chart===__NOEDITSECTION__<br />
A stacked bar chart is similar to a grouped bar in that it allows you to represent two different fields on the chart. The key difference is that the stacked bar chart layers the values of the series expression (the field represented in the legend) allowing you to easily compare the categories to one another. <br />
<br />
[[Image:iRep39.png|center|500px|''Figure 39. Stacked bar chart'']]<br />
<div align="center"><br />
''Figure 39. Stacked bar chart''<br />
</div><br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a stacked bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldName'' is the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li> <br />
<li>In the right pane, enter a numeric value in the '''Band Height''' field. You may adjust the height of the summary</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Add a summary section to the report.</li><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the stacked bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep40.png|center|500px|''Figure 40. Stacked bar chart options'']]<br />
<div align="center"><br />
''Figure 40. Stacked bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>Select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li.<br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a stacked bar chart, the series expression contains the fields whose distinct value.</li> <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart. To enter the series expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.<br />
:The Expression editor window displays.</li><br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together. To enter the category expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</vli><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
The expression to represent the field displays in the top pane.<br />
<li>Click the Apply button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the '''Save''' option from the '''File''' menu.</li> <br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11388Summarize iReport Template Data2013-09-20T15:10:33Z<p>Noah: /* Charts */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template|Modify an iReport Template]] for more information on [[Modify an iReport Template#Grouping|grouping]].<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template|Modify an iReport Template]] for more information on [[Modify_an_iReport_Template#To_add_a_variable_manually|adding variables]].<br />
<br />
===Pie Chart===__NOEDITSECTION__<br />
<br />
To add a pie chart to the report:<br />
#Create a report which groups the results by the attribute on which you would like to base your chart (e.g. ''status'')<br />
#Ensure that the Summary Band is available on the iReport template canvas.<br />
#[[Modify_an_iReport_Template#Adding a Variable to an iReport Template|Create a Variable]] to contain the values to be displayed in the chart (e.g. ''SUM_areaSize_byStatus''). This variable should be based on a numeric field (e.g. ''areaSize'') and should have the '''Reset type''' set to '''Group''' and the group selected set to the field you wish to create the chart from'' (e.g. ''status'').<br />
#Select the '''Chart''' option from the '''Palette''' pane and drag it to the '''Summary Band''' of the report template to start the '''Chart Wizard'''.<br />
#Select one of the pie chart options.<br />
#:[[Image:iReport Charts1.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
#Choose Main report dataset.<br />
#:[[Image:iReport Charts2.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# The next step is to provide the correct data for the chart to use. Pie Charts require a '''unique identifier''' and a '''numeric''' value where the unique identifier is the field to group the data by (i.e. the names of the wedges) and numeric value is the value to sum. <br />
#:[[Image:iReport Charts3.png|center|500px|''Chart options'']]<div align="center">''Chart options''</div><br />
# To select the '''unique value''' choose the '''Expression editor''' button and '''choose the ''field'' the report is grouped by''' (e.g. ''status''). Note that charts in iReport will fail if the '''unique value''' is null. In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.<br />
#: '''$F{status} == null ? "N/A" : $F{status}'''<br />
#:[[Image:iReport Charts5.png|center|500px|''Set Unique Value'']]<div align="center">''Set Unique Value''</div><br />
#Next, select the '''numeric value''' that contains the desired numeric data for the chart. '''Note: This should always be the variable created in step 3 above''' (e.g. ''SUM_status_byAreaSize''). <br />
#:[[Image:iReport Charts6.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
#Choose '''Next'''.<br />
#:[[Image:iReport Charts7.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
# Choose '''Finish'''.<br />
#:[[Image:iReport Charts8.png|center|500px|''Select the desired numeric variable'']]<div align="center">''Select the desired numeric variable''</div><br />
<br />
<br />
<li>The following figure is an example of the Chart Properties window for a report that contains a pie chart which graphs the total area size of land based on their priority.</li><br />
<br />
</ol><br />
<br />
[[Image:iRep27.png|center|500px|''Figure 27. Chart Properties'']]<br />
<div align="center"><br />
''Figure 27. Chart Properties''<br />
</div><br />
<br />
<ol start="17"><br />
<li>Click the '''Close''' button</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the icon, or by selecting the '''Save''' option from the '''File''' menu.</li><br />
</ol><br />
<br />
Below is an example of a report template that totals the area size of land by priority.<br />
<br />
[[Image:iRep28.png|center|500px|''Figure 28. Sample report template with pie chart'']]<br />
<div align="center"><br />
''Figure 28. Sample report template with pie chart''<br />
</div><br />
<br />
The resulting report pages are shown below. <br />
[[Image:iRep29.png|center|500px|''Figure 29. Sample report with pie chart'']]<br />
<div align="center"><br />
''Figure 29. Sample report with pie chart''<br />
</div><br />
<br />
===Bar Charts===__NOEDITSECTION__<br />
<br />
{{note|The sample report ''Bar Chart Sample.jrxm l''in the <iReport Installation Directory>\iReports_IMSMA\IMSMA reports directory provides an example of a report that includes a bar chart.}}<br />
<br />
To add a bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the attribute on which you would like to base your chart.</li><br />
<li>After creating the report, you should add a footer for the attribute on which the results will be grouped. This footer will be used to display the total for the group that will subsequently be used in the pie chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <'''GroupAttribute'''>Footer from the left pane where ''GroupAttribute'' is the name of the attribute on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Add a summary section to the report.</li><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>Select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>The Series Expression allows you to define an added level of detail to your bar chart. To enter the series expression value:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li><br />
$F{''attribute''} '''!= null ? $F{attribute} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
</ol><br />
<br />
[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<br />
<div align="center"><br />
''Figure 30. Bar chart –Single attribute y-axis''<br />
</div><br />
<br />
<ol><br />
*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
</ol><br />
<br />
[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<br />
<div align="center"><br />
''Figure 31. Bar chart with different series expression''<br />
</div><br />
<br />
<ol><br />
The Chart Properties window for this bar chart is shown below. Notice that the series expression and category expression differ.<br />
</ol><br />
<br />
[[Image:iRep32.png|center|500px|''Figure 32. Chart Properties – Different series and category expressions'']]<br />
<div align="center"><br />
''Figure 32. Chart Properties – Different series and category expressions''<br />
</div><br />
<br />
<ol><br />
*If you selected one of the stacked bar chart options, the series expression will be used to determine the segments of each bar. In the following figure, the series expression creates red and blue segments in each bar to indicate whether or not water access is blocked.<br />
</ol><br />
<br />
[[Image:iRep33.png|center|500px|''Figure 33. Stacked bar chart'']]<br />
<div align="center"><br />
''Figure 33. Stacked bar chart''<br />
</div><br />
<br />
<ol start="14"><br />
<li>The Category Expression is the major grouping of the horizontal axis. To enter the category expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li><br />
$F{''attribute''} '''!= null ? $F{attribute} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the expression that returns the numeric value for the key.</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that was created to store the total.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the '''Save''' option from the '''File''' menu.</li><br />
</ol><br />
<br />
===Grouped Bar Chart===__NOEDITSECTION__<br />
The horizontal axis of the bar charts discussed in the previous section compared the values of a single variable. For example, the bar chart below compares the number of different activity types. <br />
<br />
[[Image:iRep34.png|center|500px|''Figure 34. Bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 34. Bar chart comparing values of a single variable''<br />
</div><br />
<br />
In this section, you will learn how to create a grouped bar chart. A grouped bar chart compares the values of a single variable in one group to the same variables in another group. In the example below, the grouped bar chart still compares the number of activity types. However, the chart also compares the number of activity types between the districts. The number of activity types (clearance, impact survey, technical survey, and road clearance) are represented by the different bar colours as indicated in the legend. The coloured bars are clustered together based on their district. The first cluster of bars shows the number of activity in the Bolikon district. The second cluster of bars shows the number of activities in the Waltern district.<br />
<br />
[[Image:iRep35.png|center|500px|''Figure 35. Grouped bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 35. Grouped bar chart comparing values of a single variable''<br />
</div><br />
<br />
The two main differences between adding a bar chart and a grouped bar chart are:<br />
*The grouped bar chart requires that you specify at least two groupings for the report. <br />
*The key expression and the category expression will differ; whereas, for a bar chart, the value for these expressions is the same. <br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a grouped bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldNameis'' the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary.</li><br />
<li>Click the '''Apply''' button.</li><br />
<li>Add a summary section to the report.</li><br />
</ol><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep36.png|center|500px|''Figure 36. Bar chart options'']]<br />
<div align="center"><br />
''Figure 36. Bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart.</li><br />
</ol><br />
<br />
[[Image:iRep37.png|center|500px|''Figure 37. Bar chart series expression'']]<br />
<div align="center"><br />
''Figure 37. Bar chart series expression''<br />
</div><br />
<br />
To enter the series expression:<br />
<ol start="15"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together.</li><br />
</ol><br />
<br />
[[Image:iRep38.png|center|500px|''Figure 38. Bar chart category expression'']]<br />
<div align="center"><br />
''Figure 38. Bar chart category expression''<br />
</div><br />
<br />
To enter the category expression:<br />
<ol start="16"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li> <br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the Save option from the '''File''' menu.</li><br />
</ol><br />
<br />
{{note|iReport requires you to save the report after adding or changing a chart.}}<br />
<br />
<ol start="20"><br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
===Stacked Bar Chart===__NOEDITSECTION__<br />
A stacked bar chart is similar to a grouped bar in that it allows you to represent two different fields on the chart. The key difference is that the stacked bar chart layers the values of the series expression (the field represented in the legend) allowing you to easily compare the categories to one another. <br />
<br />
[[Image:iRep39.png|center|500px|''Figure 39. Stacked bar chart'']]<br />
<div align="center"><br />
''Figure 39. Stacked bar chart''<br />
</div><br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a stacked bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldName'' is the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li> <br />
<li>In the right pane, enter a numeric value in the '''Band Height''' field. You may adjust the height of the summary</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Add a summary section to the report.</li><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the stacked bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep40.png|center|500px|''Figure 40. Stacked bar chart options'']]<br />
<div align="center"><br />
''Figure 40. Stacked bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>Select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li.<br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a stacked bar chart, the series expression contains the fields whose distinct value.</li> <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart. To enter the series expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.<br />
:The Expression editor window displays.</li><br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together. To enter the category expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</vli><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
The expression to represent the field displays in the top pane.<br />
<li>Click the Apply button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the '''Save''' option from the '''File''' menu.</li> <br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Charts3.png&diff=11383File:IReport Charts3.png2013-09-20T14:50:15Z<p>Noah: uploaded a new version of &quot;File:IReport Charts3.png&quot;</p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Charts6.png&diff=11382File:IReport Charts6.png2013-09-20T14:49:10Z<p>Noah: uploaded a new version of &quot;File:IReport Charts6.png&quot;</p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Summarize_iReport_Template_Data&diff=11380Summarize iReport Template Data2013-09-20T14:30:21Z<p>Noah: /* Charts */</p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
==Summarizing Report Data==__NOEDITSECTION__<br />
In addition to displaying report details in an iReport template, the iReport Designer allows you create summaries or calculations of data returned in the report. These can take the form of totals, sums, and counts (stored in Variables), or more complicated data summaries such as Crosstabs or Charts. Because summarizing data necessarily depends on multiple records, data summaries must exist in bands ''after'' the Detail band such as the Summary band, Footer bad, or Group Footer bands.<br />
<br />
===Adding a Footer or Summary Section to the Report===__NOEDITSECTION__<br />
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. If a desired band is not visible on the iReport Designer canvas:<br />
# Select the desired band in the '''Report Inspector'''<br />
# In the '''Properties''' pane, change the '''Band Height''' property to something more than 0 (e.g. 50).<br />
<br />
===Displaying Counts===__NOEDITSECTION__<br />
iReport has a built-in variable for calculating the number of records in a report and the number of records in each group if the report contains groups. The number of records in the report is stored in the REPORT_COUNT variable. The number of records in each group is stored in the <''GroupField''>_COUNT where GroupField is the name of the field on which the group is created. <br />
<br />
To display one of the built-in count variables in the report:<br />
<ol><br />
<li>Expand the appropriate section to the report. If you would like to add the number of records in the report, you will need to expand the summary section of the report. If you would like to add the number of records for each group, you will need to expand the <''GroupField''>Footer section.</li><br />
<li>From the '''Report Inspector''', select '''Variables'''.</li><br />
:The REPORT_COUNT variable will always be available in the Variables list. The variable to display the count for the group will only be displayed if the report contains groups.<br />
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li><br />
</ol><br />
<br />
[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]<br />
<div align="center"><br />
''Figure 22. REPORT_COUNT element in summary section''<br />
</div><br />
<br />
{{note|If the REPORT_COUNT element is dragged to a section of the report other than the summary, the value returned by the REPORT_COUNT variable will be determined by where it is placed. For example, if the REPORT_COUNT is placed in the pageFooter section, the value returned will be the number of records displayed so far.}}<br />
<br />
<ol start="4"><br />
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li><br />
</ol><br />
<br />
{{note|It may be helpful to add a text label beside any counts that you add to report to identify the value. To add a text label, drag the text field element [[Image:iRepText.png]] from the '''Palette''' pane. }}<br />
<br />
===Displaying Totals===__NOEDITSECTION__<br />
iReport allows you to display the total of a particular attribute in the report. This is done by creating a variable to store the total value (see [[Modify an iReport Template#Adding a Variable to an iReport Template| Adding a Variable to an iReport]]).<br />
<br />
To display a total:<br />
<ol><br />
<li>Ensure that a group footer or summary section has been added to the report.</li><br />
<li>From the '''Report Inspector''' pane, choose '''Variables''' and drag the variable to the summary section. If you drag it to the footer, the total for the values in the group will be calculated. If you drag it to the summary, the total for all values will be calculated.</li><br />
</ol><br />
<br />
In addition to the built-in functions to calculate the number of records and the sum of a field, iReport also allows you to define other types of variable calculations. A variable is a named object that stores the result of a calculation. iReport allows you to define new variables and how those variables should be calculated. For example, you may define a variable that calculates the average for a particular field such as the area size. Or, you may wish to display the maximum value of a field. In these situations, you may define a custom variable. <br />
<br />
To create a custom variable:<br />
# Follow the steps to [[Modify an iReport Template#Adding a Variable to an iReport Template| add a variable to an iReport]]<br />
# From the '''Calculation Type''' list in the '''Properties''' pane, select the calculation that you would like to perform.<br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Calculation types'''<br />
|-<br />
| width="150pt" | '''Calculation type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || No type calculation performed.<br />
|-<br />
| Count || Counts the number of non-null results.<br />
|-<br />
| Distinct count || Counts the number of unique results.<br />
|-<br />
| Sum || Adds the values together.<br />
|-<br />
| Average || Averages the values together.<br />
|-<br />
| Lowest || Returns the lowest value.<br />
|-<br />
| Highest || Returns the highest value.<br />
|-<br />
| Standard deviation || Returns the standard deviation of all values.<br />
|-<br />
| Variance || Returns the variance of all values.<br />
|-<br />
| System || No calculation is made. Instead the last value is stored.<br />
|}<br />
</center><br />
<br />
<ol start="3"><br />
<li>From the Reset Type list, select when a variable value should be reset to the initial value. For example, suppose you wanted to count the number of accidents in each location. Each time a new group—in this case a location—is encountered, the variable should be reset. To do this, you would need to reset the value of the variable after each group.</li><br />
</ol><br />
<br />
<center><br />
{| class="wikitable" width="600"<br />
|-<br />
| align="center" colspan="2" | '''Table 5. Reset Types'''<br />
|-<br />
| width="150pt" | '''Reset Type'''<br />
| width="450pt" | '''Description'''<br />
|-<br />
| None || The initial value is always ignored.<br />
|-<br />
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.<br />
|-<br />
| Page || The variable is initialised at the top of each new page.<br />
|-<br />
| Column || The variable is initialised in each new column.<br />
|-<br />
| Group || The variable is initialised at each new group.<br />
|}<br />
</center><br />
<br />
<ol start="4"><br />
<li>If you select ''Group'' as the '''Reset Type''', you will need to select the group on which you would like to reset the variable from the '''Reset Group''' list. The '''Reset Group''' list will contain all fields on which the report is grouped.</li><br />
</ol><br />
<br />
{{note|If the field on which the variable should be reset is not listed in the Reset Group list, be sure that the field is included as one of the grouping levels for the report.}}<br />
<br />
<ol start="5"><br />
<li>The '''Variable Expression''' field specifies the expression that will be provided to the variable. Typically, this will be the value of a field in the report. To specify a field in the report edit the '''Variable Expression''' field.<br />
[[Image:IReport VariableAdd5.png|center|500px|''Variable Expression Editor'']]<div align="center">''Variable Expression Editor''</div></li><br />
</ol><br />
<br />
In addition to the summary functions available on the variable, specific expressions can be used in the Expression Editor to define values. For example:<br />
{| class="wikitable" width="600" align="center"<br />
|-<br />
| align="center" colspan="2" | '''Expression Operations'''<br />
|-<br />
| width="150pt" | '''Operation'''<br />
| width="450pt" | '''Expression'''<br />
|-<br />
| Division || $F{areaSize}/$V{REPORT_COUNT}<br />
|-<br />
| Addition || $F{areaSize} + 500.0<br />
|-<br />
| Subtraction || $F{areaSize} - $P{ClearedArea}<br />
|-<br />
| Multiplication || $F{areaSize} * $V{REPORT_COUNT}<br />
|-<br />
| Concatenation (string only)|| $F{localId} + $P{LocationName}<br />
|}<br />
<br />
==Crosstabs==<br />
In addition to summary variables, iReport provides the capability to build crosstab tables that display data in a grid for easy analysis and summary. Crosstabs allow you to choose data rows, columns, and the variable to measured and then automatically produce a grid of results for display in a chart. As with other summary variables Crosstabs are generally used in the '''Summary Band''' in a report. <br />
<br />
To create a Crosstab:<br />
# In the '''Palette''' pane, drag a '''Crosstab''' item to the Summary Band of the report.<br />
# The Crosstab wizard displays<br />
#: [[Image:IReport Crosstab1.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Row''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab2.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' to use in the '''Column''' of the Crosstab grid.<br />
#: [[Image:IReport Crosstab3.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Select the '''Field''' or '''Variable''' to use to represent the data in the grid. Typically this is a numeric field (e.g. areaSize) or if a count of the records is desired, the ''REPORT_COUNT'' variable.<br />
#: [[Image:IReport Crosstab4.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# Finalize the Crosstab display.<br />
#: [[Image:IReport Crosstab5.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
# The Crosstab displays.<br />
#: [[Image:IReport Crosstab6.png|center|500px|''Crosstab wizard'']]<div align="center">''Crosstab wizard''</div><br />
<br />
The report can now be run or additional adjustments to the report can be made including resizing columns and rows, number formatting, or display adjustments.<br />
[[Image:IReport Crosstab7.png|center|500px|''Crosstab Preview'']]<div align="center">''Example Crosstab Preview''</div><br />
<br />
==Charts==<br />
<br />
Charts provide a visual representation of the report data. Before you add a chart to your report, you should ensure that your report contains the following:<br />
#At least one grouping. The report groupings are used by iReport to determine what fields may be plotted. See [[Modify an iReport Template#Grouping|Modify an iReport Template]] for more information on Grouping.<br />
#At least one variable that contains a calculation. This calculation may be a count, total, or other custom calculation. These calculated variables define the size of the chart segment. The '''Reset type''' of this calculation should be set to '''Group''' and use the report grouping defined in #1. See [[Modify_an_iReport_Template#To_add_a_variable_manually|Modify an iReport Template]] for more information on adding variables.<br />
<br />
===Pie Chart===__NOEDITSECTION__<br />
<br />
To add a pie chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the attribute on which you would like to base your chart.</li><br />
<li>After creating the report, you should add a footer for the attribute on which the results will be grouped. This footer will be used to display the total for the group that will subsequently be used in the pie chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupAttribute''>Footer from the left pane where ''GroupAttribute'' is the name of the attribute on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Add a summary section to the report.</li><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the pie chart options.</li><br />
</ol><br />
<br />
[[Image:iRep26.png|center|500px|''Figure 26. Pie chart options'']]<br />
<div align="center"><br />
''Figure 26. Pie chart options''<br />
</div><br />
<br />
<ol start="7"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>Select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>The Section Value tab should be selected by default. If it is not, select it.</li><br />
<li>The '''Key Expression''' defines the various slices of the pie chart. This will typically be each unique value for an attribute. For example, if the chart were to contain the total area size of land with a particular priority, the Key Expression would return the unique values for priority (e.g., Low, Medium, or High). To enter the key expression value:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li> <br />
:$F{''attribute''} '''!= null ? $F{''attribute''} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the expression that returns the numeric value for the key. For example, it may be the total land size of high priority land.</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that was created to store the total.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Label Expression''' field contains the expression that is used to determine the label for the segment of the pie chart. Because this expression will most likely be the same as the one used in the '''Key Expression''', you can copy the expression from the Key Expression field and paste it into the '''Label Expression''' field.</li><br />
<li>The following figure is an example of the Chart Properties window for a report that contains a pie chart which graphs the total area size of land based on their priority.</li><br />
<br />
</ol><br />
<br />
[[Image:iRep27.png|center|500px|''Figure 27. Chart Properties'']]<br />
<div align="center"><br />
''Figure 27. Chart Properties''<br />
</div><br />
<br />
<ol start="17"><br />
<li>Click the '''Close''' button</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the icon, or by selecting the '''Save''' option from the '''File''' menu.</li><br />
</ol><br />
<br />
Below is an example of a report template that totals the area size of land by priority.<br />
<br />
[[Image:iRep28.png|center|500px|''Figure 28. Sample report template with pie chart'']]<br />
<div align="center"><br />
''Figure 28. Sample report template with pie chart''<br />
</div><br />
<br />
The resulting report pages are shown below. <br />
[[Image:iRep29.png|center|500px|''Figure 29. Sample report with pie chart'']]<br />
<div align="center"><br />
''Figure 29. Sample report with pie chart''<br />
</div><br />
<br />
===Bar Charts===__NOEDITSECTION__<br />
<br />
{{note|The sample report ''Bar Chart Sample.jrxm l''in the <iReport Installation Directory>\iReports_IMSMA\IMSMA reports directory provides an example of a report that includes a bar chart.}}<br />
<br />
To add a bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the attribute on which you would like to base your chart.</li><br />
<li>After creating the report, you should add a footer for the attribute on which the results will be grouped. This footer will be used to display the total for the group that will subsequently be used in the pie chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <'''GroupAttribute'''>Footer from the left pane where ''GroupAttribute'' is the name of the attribute on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Add a summary section to the report.</li><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>Select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>The Series Expression allows you to define an added level of detail to your bar chart. To enter the series expression value:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li><br />
$F{''attribute''} '''!= null ? $F{attribute} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
The expression that you enter in the Series Expression field will vary based on how you want the horizontal axis to appear:<br />
*If you would like the horizontal axis of the bar chart to reflect a single attribute such as the chart displayed below, the Series Expression will be the same as the Category expression.<br />
</ol><br />
<br />
[[Image:iRep30.png|center|500px|''Figure 30. Bar chart –Single attribute y-axis'']]<br />
<div align="center"><br />
''Figure 30. Bar chart –Single attribute y-axis''<br />
</div><br />
<br />
<ol><br />
*If you would like the horizontal axis of the bar chart to reflect the values of an additional attribute, the Series Expression would be the expression for the secondary level of detail. In the example shown below, the x-axis reflects the land priorities (e.g., Low, Medium, or High). In addition to displaying the priority, the bars of the chart use a different colour to reflect those land which block water access (red) vs. those that do not block the water (blue). <br />
</ol><br />
<br />
[[Image:iRep31.png|center|500px|''Figure 31. Bar chart with different series expression'']]<br />
<div align="center"><br />
''Figure 31. Bar chart with different series expression''<br />
</div><br />
<br />
<ol><br />
The Chart Properties window for this bar chart is shown below. Notice that the series expression and category expression differ.<br />
</ol><br />
<br />
[[Image:iRep32.png|center|500px|''Figure 32. Chart Properties – Different series and category expressions'']]<br />
<div align="center"><br />
''Figure 32. Chart Properties – Different series and category expressions''<br />
</div><br />
<br />
<ol><br />
*If you selected one of the stacked bar chart options, the series expression will be used to determine the segments of each bar. In the following figure, the series expression creates red and blue segments in each bar to indicate whether or not water access is blocked.<br />
</ol><br />
<br />
[[Image:iRep33.png|center|500px|''Figure 33. Stacked bar chart'']]<br />
<div align="center"><br />
''Figure 33. Stacked bar chart''<br />
</div><br />
<br />
<ol start="14"><br />
<li>The Category Expression is the major grouping of the horizontal axis. To enter the category expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the attribute that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the attribute displays in the top pane.<br />
<li>In order to account for null values, you will need to modify the expression so that null values are grouped into their own group. The expression should be modified to include the bolded text below. You should replace attribute with the name of the attribute that you selected in step b above.</li><br />
$F{''attribute''} '''!= null ? $F{attribute} : "Unknown"'''<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the expression that returns the numeric value for the key.</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that was created to store the total.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the '''Save''' option from the '''File''' menu.</li><br />
</ol><br />
<br />
===Grouped Bar Chart===__NOEDITSECTION__<br />
The horizontal axis of the bar charts discussed in the previous section compared the values of a single variable. For example, the bar chart below compares the number of different activity types. <br />
<br />
[[Image:iRep34.png|center|500px|''Figure 34. Bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 34. Bar chart comparing values of a single variable''<br />
</div><br />
<br />
In this section, you will learn how to create a grouped bar chart. A grouped bar chart compares the values of a single variable in one group to the same variables in another group. In the example below, the grouped bar chart still compares the number of activity types. However, the chart also compares the number of activity types between the districts. The number of activity types (clearance, impact survey, technical survey, and road clearance) are represented by the different bar colours as indicated in the legend. The coloured bars are clustered together based on their district. The first cluster of bars shows the number of activity in the Bolikon district. The second cluster of bars shows the number of activities in the Waltern district.<br />
<br />
[[Image:iRep35.png|center|500px|''Figure 35. Grouped bar chart comparing values of a single variable'']]<br />
<div align="center"><br />
''Figure 35. Grouped bar chart comparing values of a single variable''<br />
</div><br />
<br />
The two main differences between adding a bar chart and a grouped bar chart are:<br />
*The grouped bar chart requires that you specify at least two groupings for the report. <br />
*The key expression and the category expression will differ; whereas, for a bar chart, the value for these expressions is the same. <br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a grouped bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldNameis'' the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li><br />
<li>In the right pane, enter a numeric value in the Band Height field. You may adjust the height of the summary.</li><br />
<li>Click the '''Apply''' button.</li><br />
<li>Add a summary section to the report.</li><br />
</ol><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep36.png|center|500px|''Figure 36. Bar chart options'']]<br />
<div align="center"><br />
''Figure 36. Bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li><br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart.</li><br />
</ol><br />
<br />
[[Image:iRep37.png|center|500px|''Figure 37. Bar chart series expression'']]<br />
<div align="center"><br />
''Figure 37. Bar chart series expression''<br />
</div><br />
<br />
To enter the series expression:<br />
<ol start="15"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together.</li><br />
</ol><br />
<br />
[[Image:iRep38.png|center|500px|''Figure 38. Bar chart category expression'']]<br />
<div align="center"><br />
''Figure 38. Bar chart category expression''<br />
</div><br />
<br />
To enter the category expression:<br />
<ol start="16"><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li> <br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the Save option from the '''File''' menu.</li><br />
</ol><br />
<br />
{{note|iReport requires you to save the report after adding or changing a chart.}}<br />
<br />
<ol start="20"><br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
===Stacked Bar Chart===__NOEDITSECTION__<br />
A stacked bar chart is similar to a grouped bar in that it allows you to represent two different fields on the chart. The key difference is that the stacked bar chart layers the values of the series expression (the field represented in the legend) allowing you to easily compare the categories to one another. <br />
<br />
[[Image:iRep39.png|center|500px|''Figure 39. Stacked bar chart'']]<br />
<div align="center"><br />
''Figure 39. Stacked bar chart''<br />
</div><br />
<br />
To add a grouped bar chart to the report:<br />
<ol><br />
<li>Create a report which groups the results by the fields that will be represented on the horizontal axis of the chart.</li><br />
</ol><br />
<br />
{{note|For a stacked bar chart, you will need to specify at least two groupings.}}<br />
<br />
<ol start="2"><br />
<li>Add any variables that you may need to calculate the value that you would like to show on the chart.</li><br />
<li>If you would like to display the calculated variable for each group, you should add the footer for the field on which the results will be grouped. This footer will be used to display the variable for the group that will subsequently be used in the chart. To add a group footer:</li><br />
<ol type="a"><br />
<li>From the '''View''' menu, select '''Bands'''.</li><br />
:The <FileName> bands… window displays. <br />
<li>Select <''GroupFieldName''>Footer from the left pane where ''GroupFieldName'' is the name of the field on which the results will be grouped. For example, if you are creating a report on land and group the results by the priority, the name of the band would be ''priorityFooter''.</li> <br />
<li>In the right pane, enter a numeric value in the '''Band Height''' field. You may adjust the height of the summary</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Add a summary section to the report.</li><br />
<li>Click the [[Image:iRepBarChart.png]] icon.</li><br />
<li>In the summary section of the report, hold down the mouse button and drag the cursor to form the rectangle which will contain the chart.</li><br />
:A window of the various chart options displays.<br />
<li>Select one of the stacked bar chart options.</li><br />
</ol><br />
<br />
[[Image:iRep40.png|center|500px|''Figure 40. Stacked bar chart options'']]<br />
<div align="center"><br />
''Figure 40. Stacked bar chart options''<br />
</div><br />
<br />
<ol start="8"><br />
<li>Click the '''OK''' button.</li><br />
<li>Right-click anywhere on the chart.</li><br />
<li>Select the '''Chart Properties''' option.</li><br />
<li>From the Chart Properties window, select the Chart Data tab.</li><br />
<li>From the Chart Data tab, select the Details tab.</li.<br />
<li>Click the '''Add''' button.</li><br />
:The Chart Properties window displays. By default, the Data tab should be selected. <br />
<li>For a stacked bar chart, the series expression contains the fields whose distinct value.</li> <br />
<li>For a grouped bar chart, the series expression contains the field whose distinct values you would like to show via different colours on the bar chart. To enter the series expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Key Expression field.<br />
:The Expression editor window displays.</li><br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
:The expression to represent the field displays in the top pane.<br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>The Category Expression is the field by which the series expression is grouped together. To enter the category expression:</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Category expression field.</vli><br />
:The Expression editor window displays.<br />
<li>From the bottom pane, double-click the name of the field that contains the data that you would like to include in the chart.</li><br />
The expression to represent the field displays in the top pane.<br />
<li>Click the Apply button.</li><br />
</ol><br />
<li>The '''Value Expression''' field contains the variable that returns the numeric value that will be represented on the chart.</li><br />
<ol type="a"><br />
<li>Click the [[Image:iRepEditor.png]] icon that is displayed beside the Value Expression field.</li><br />
:The Expression editor window displays.<br />
<li>From the Objects and expressions tab, select '''Variables''' from the left pane.</li><br />
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the variable that you would like to represent on the chart.</li><br />
<li>Click the '''Apply''' button.</li><br />
</ol><br />
<li>Click the '''OK''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Click the '''Close''' button.</li><br />
:The Chart Properties window closes.<br />
<li>Save the report by either clicking the [[Image:iRepSave.png]] icon, or by selecting the '''Save''' option from the '''File''' menu.</li> <br />
<li>Click the [[Image:iRepCompile.png]] button to compile the report.</li><br />
<li>Click the [[Image:iRepRun.png]] button to execute the report.</li><br />
</ol><br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Format_an_iReport_Template&diff=11378Format an iReport Template2013-09-20T14:16:05Z<p>Noah: </p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
iReport Designer provides many ways to format the appearance of an iReport template. These include the ability to:<br />
*add formatting elements to the iReport such as lines, rectangles, circles, etc <br />
*edit the position and size of elements on the iReport template relative to one another<br />
*change colors, fonts, and other properties<br />
*perform conditional displays based on data in the report<br />
<br />
==Conditional Display==<br />
* Null checks<br />
<br />
<br />
==Adding Formatting Elements==<br />
* Adding lines<br />
<br />
==Formatting Tools==<br />
* float vs fix relative<br />
<br />
==Working with Bands==<br />
<br />
==Formatting Subreports, Charts, and Crosstabs==<br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=Format_an_iReport_Template&diff=11377Format an iReport Template2013-09-20T14:09:57Z<p>Noah: </p>
<hr />
<div>__FORCETOC__<br />
{{TOC right}}<br />
{{HowTo's<br />
|[[Start and Configure i-Report|Start and Configure i-Report]]<br />
|[[Create a Basic i-Report Template|Create a Basic i-Report Template]]<br />
|[[Modify an iReport Template|Modify an iReport Template]]<br />
|[[Format an iReport Template|Format an iReport Template]]<br />
|[[Create i-Report Templates with Subreports|Create i-Report Templates with Subreports]]<br />
|[[Summarize i-Report Template Data|Summarize i-Report Template Data]]<br />
}}<br />
<br />
iReport Designer provides many ways to format the appearance of an iReport template. These include the ability to:<br />
*add formatting elements to the iReport such as lines, rectangles, circles, etc <br />
*edit the position and size of elements on the iReport template relative to one another<br />
*change colors, fonts, and other properties<br />
*perform conditional displays based on data in the report<br />
<br />
==Conditional Display==<br />
<br />
* Format buttons<br />
* Null checks<br />
* Adding lines<br />
* Working with Bands<br />
* float vs fix relative<br />
* formatting sub reports<br />
<br />
{{NavBox HowTo use iReport}}</div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_ChartsPreview.png&diff=11376File:IReport ChartsPreview.png2013-09-20T14:08:27Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Charts8.png&diff=11375File:IReport Charts8.png2013-09-20T14:08:13Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Charts7.png&diff=11374File:IReport Charts7.png2013-09-20T14:07:52Z<p>Noah: </p>
<hr />
<div></div>Noahhttp://mwiki.gichd.org:8090/mediawiki/index.php?title=File:IReport_Charts6.png&diff=11373File:IReport Charts6.png2013-09-20T14:07:40Z<p>Noah: </p>
<hr />
<div></div>Noah