Modify an iReport Template

Revision as of 17:57, 16 September 2013 by Noah (talk | contribs)

Introduction

  • Adding Charts and Graphs
  • Adding Crosstabs
  • Query Limitation
  • Special iReport Fields

Working with Fields, Variables, and Parameters

Adding a Field to an iReport Template

If you need to include a field that was not selected while using the Report Wizard, you will need to know the name of the field that is used by the data source. Find a list of available field names by using the Report Wizard.

To add a field to your report:

  1. From the View menu, select the Fields option.
  2. A window displays three tabs (Fields, Variables, and Parameters).
  3. From the Fields tab, click the New button.
  4. The Add/modify field window displays.
  5. In the Field Name field, enter the name of the field that you would like to include.
  6. Click the OK button.
  7. The field is included on the Fields tab.
  8. Close the window that displays the Fields, Variables, and Parameters tabs.
  9. Reposition the fields on your report as needed to accommodate the new field.
  10. Click the File:IRepF.png icon.
  11. Click the detail section of the report.
  12. While holding down the mouse button, drag the cursor to form the rectangle which will contain the new field.
  13. Release the mouse button.
  14. A placeholder for the field is displayed in the design section of the report.
  15. Double-click the placeholder that was added for the field.
  16. Change the placeholder text so that the field that you added is between the brackets.

Adding a Parameter to an iReport Template

Adding a parameter to an iReport Template.

  1. Right click -> Create Parameter
  2. Add a name, leave type as string

Adding a Variable to an iReport Template

Two ways to do it.

  1. Add a variable manually
  2. Drag to Summary Band

Adding a variable manually:

  1. Right click -> Add Variable

Sorting and Grouping

Adding a Group to an iReport Template

Note.jpg The field on which you would like to group your report results must be included in the report.

To add a group to an existing report:

  1. From the View menu, select Report Groups.
  2. A window displays the groups for the report.
  3. Click the New button.
  4. The Add/modify group window displays.
  5. Enter an identifier for the group. This should be a meaningful name that allows you to easily identify the contents of the group such as the field on which the results are grouped.
  6. Click the File:IRepExpress.png icon.
  7. The Expression editor window displays.
  8. Ensure that the Objects and expressions tab is selected.
  9. Click Fields.
  10. Double-click the name of the field on which you would like to add a grouping.
  11. The Expression editor window shows $F{FieldName} where FieldName is the name of the field that you selected previously.
  12. Click the Apply button.
  13. The Add/modify group window displays the expression in the Group Expression field.
  14. Click the OK button.
  15. The Add/modify group window closes.
Note.jpg You may also enter the expression in the Group Expression field if you know the exact spelling of the field name on which you would like to group the results. The syntax is $F{FieldName}.

Sorting Report Results

It may be helpful to sort the report results using the value in one or more of the fields. Sorting the results makes it easier to review the results and locate any records that you may be searching for. To sort report results:

  1. Create the report.
  2. From the Data menu, select the Report Query option.
  3. The Report query window displays.
  4. Click the Sort options button that is located at the bottom of the Report query window.
  5. The Sorting Options window displays.
  6. Click the Add Field button.
  7. The Sort Field window displays. The Sort by list displays all the fields that you have selected for the report.
  8. From the Sort by list, select the field by which you would like to sort the report results.
Note.jpg When sorting data in reports that contain groups, ensure the “Group by” fields appear first in the sort order.
  1. From the Sort Type list, select either the Ascending or Descending sort order.
  2. Click the OK button.
  3. The selected field displays in the Sorting Options window.
  4. Repeat steps 4-7 for each field on which you would like to sort the results.
  5. After you have completed adding the fields on which you would like to sort the results, click the Close button.
  6. The Sorting Options window closes.
  7. From the Report query window, click the OK button.
  8. The Report query window closes.

You will need to compile and execute the report for the sort options to take effect.


Contents

Working with Images=

Adding an Image to an iReport Template

????