Changes

Jump to: navigation, search

Summarize iReport Template Data

10,090 bytes added, 19:29, 23 October 2012
Created page with "==Editing Summarizing Report Data== ===Adding a Footer or Summary Section to the Report=== Totals, averages, and other summary data are typically found at the end of a groupin..."
==Editing Summarizing Report Data==
===Adding a Footer or Summary Section to the Report===
Totals, averages, and other summary data are typically found at the end of a grouping or at the end of a report. You may add a section—or ''band'' as it is referred to in iReport—by doing the following:

<ol>
<li>From the '''View''' menu, select '''Bands'''.</li>
:The <FileName> bands… window displays.
<li>Do one of the following:</li>
*If you would like to add a footer at the end of a grouping, select the <''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 hazards and group the results by the priority, the name of the band would be priorityFooter.
*If you would like to add a summary section, select ''summary'' from the left pane.
<li>In the right pane, enter a numeric value in the '''Band Height''' field. The height of the section may also be adjusted later.</li>
<li>Click the '''Apply''' button.</li>
:The section is added to the report.
</ol>

===Displaying Counts===
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.

To display one of the built-in count variables in the report:
<ol>
<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>
<li>From the '''View''' menu, select '''Variables'''.</li>
: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.
<li>To display the number of records in your report, drag the REPORT_COUNT variable to the summary section of the report.</li>
</ol>

[[Image:iRep22.png|center|500px|''Figure 22. REPORT_COUNT element in summary section'']]
<div align="center">
''Figure 22. REPORT_COUNT element in summary section''
</div>

{| class="wikitable"
|-
| [[File:Note.jpg | 40px]] || 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.
|}

<ol>
<li>To display the number of records in each group, drag the <GroupName>_COUNT variable to the <''GroupName''>Footer section.</li>
</ol>

{| class="wikitable"
|-
| [[File:Note.jpg | 40px]] || 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, click the [[Image:iRepText.png]] icon.
|}

===Displaying Totals===
iReport allows you to display the total of a particular attribute in the report.

To display a total:
<ol>
<li>Ensure that a group footer or summary section has been added to the report.</li>
<li>From the Library pane, click [[Image:iRepTotal.png]].</li>
</ol>

{| class="wikitable"
|-
| [[File:Note.jpg | 40px]] || If the Library pane is not displayed, display it by doing the following:
<ol>
<li>From the '''View''' menu, select '''Docking Panes'''.</li>
<li>From the '''Docking Panes''' menu, select '''Library'''.</li>
</ol>
|}

<ol start="3">
<li>Drag the [[Image:iRepTotal.png]] to the footer or summary section of the report. 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>
:A window displays to allow you to select the object to sum ([[:Image:iRep23.png]]).
</ol>

[[Image:iRep23.png|center|500px|''Figure 23. Window to select object to sum'']]
<div align="center">
''Figure 23. Window to select object to sum''
</div>

<ol>
<li>Double-click ''Fields''.</li>
<li>Click the name of the attribute that you would like to sum.</li>
<li>Click the '''OK''' button.</li>
</ol>

===Creating Custom Variables===
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 a variable. 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.

To create a custom variable:
<ol>
<li>From the '''View''' menu, select '''Variables'''.</li>
<li>Click the '''New''' button.</li>
:The Add/modify variable window displays.
</ol>

[[Image:iRep24.png|center|500px|''Figure 24. Add/modify variable window'']]
<div align="center">
''Figure 24. Add/modify variable window''
</div>

<ol start="3">
<li>In the '''Variable Name''' field, enter a name for the variable. You should provide a name that is meaningful and indicative of what the value returns.</li>
<li>From the '''Variable Class Type''' list, select the data type of the resulting value. The variable class type will depend on the field that you are using in the calculation.</li>
</ol>

{| class="wikitable"
|-
| [[File:Note.jpg | 40px]] || To determine the class type of a field:
<ol>
<li>Right-click the field element in the report pane.</li>
<li>Select '''Properties'''.</li>
<li>Select the '''Text Field''' tab.</li>
:The class type will be displayed in the '''Text Field Expression Class''' field.
</ol>
|}

<ol start="5">
<li>From the '''Calculation Type''' list, select the calculation that you would like to perform.</li>
</ol>

<center>
{| class="wikitable" width="600"
|-
| align="center" colspan="2" | '''Table 4. Calculation types'''
|-
| width="150pt" | '''Calculation type'''
| width="450pt" | '''Description'''
|-
| None || No type calculation performed.
|-
| Count || Counts the number of non-null results.
|-
| Distinct count || Counts the number of unique results.
|-
| Sum || Adds the values together.
|-
| Average || Averages the values together.
|-
| Lowest || Returns the lowest value.
|-
| Highest || Returns the highest value.
|-
| Standard deviation || Returns the standard deviation of all values.
|-
| Variance || Returns the variance of all values.
|-
| System || No calculation is made. Instead the last value is stored.
|}
</center>

<ol start="6">
<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>
</ol>

<center>
{| class="wikitable" width="600"
|-
| align="center" colspan="2" | '''Table 5. Reset Types'''
|-
| width="150pt" | '''Reset Type'''
| width="450pt" | '''Description'''
|-
| None || The initial value is always ignored.
|-
| Report || The variable is initialised once at the beginning of the report using the '''Initial Expression''' value.
|-
| Page || The variable is initialised at the top of each new page.
|-
| Column || The variable is initialised in each new column.
|-
| Group || The variable is initialised at each new group.
|}
</center>

<ol start="7">
<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>
</ol>

[[Image:iRep25.png|center|500px|''Figure 24. Add/modify variable window'']]
<div align="center">
''Figure 25. Reset Type and Reset Group''
</div>

{| class="wikitable"
|-
| [[File:Note.jpg | 40px]] || 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.
|}

<ol start="8">
<li>From the '''Increment Type''' list, select the increment at which the value will need to be evaluated. It is useful when you want to calculate sub-totals.</li>
<li>From the '''Increment Group''' list, select the group at which the variable will be incremented.</li>
<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:</li>
<ol type="a">
<li>Click the [[Image:iRepEditor.png]] button that is displayed beside the '''Variable Expression''' field.</li>
:The Expression editor window displays.
<li>From the Objects and expressions tab, select '''Fields''' from the left pane.</li>
<li>From the middle pane at the bottom of the Expression editor window, double-click the name of the field that you would like to use in the calculation.</li>
<li>Click the '''Apply''' button.</li>
:The Expression editor window closes. The Add/modify variable window displays the selected field in the Variable Expression field.
<li>Click the '''OK''' button.</li>
:The Add/modify variable window closes and the variable that you just added is listed as a variable in the Library pane.
</ol>
</ol>

{| class="wikitable"
|-
| [[File:Note.jpg | 40px]] || If the Library pane is not displayed, display it by doing the following:
<ol>
<li>From the '''View''' menu, select '''Docking Panes'''.</li>
<li>From the '''Docking Panes''' menu, select '''Library'''.</li>
</ol>
|}

<ol start="11">
<li>From the Library pane, click the name of the variable that you created for the average.</li>
<li>Drag the variable to the summary section of the report.</li>
</ol>
0
edits

Navigation menu