Template fields
The template field is a Toolbox element unique to the report template.
Use a template field when you want to:
- Create different report elements for different fields, depending on the data. For example, you might want a string field to create a Word Box or Word Wrap Box, and a numeric field to create a Decimal Format Box.
- Create a dynamic number of report elements, depending on the number of fields selected.
The Template Field can be found under Templates in the Tool Box view. See Figure 1.
Add template fields to the report template in the same way as other elements. Figure 2 shows an example of a template field in the Report Structure view. In most cases, you place a template field as a descendant of a template field trigger.
When you create a report using a template containing a Template Field, the user is prompted to select the fields from the data schema to populate the template field. The number of fields they can select is unlimited, although there may be a logical limit to how much data they want to add to that section of the report. In the final report, the Template Field becomes one or more standard report elements (such as Word Boxes or Image Boxes), depending on which fields were selected. For example, if a DECIMAL field is selected for inclusion in the Template Field, a Decimal Box is placed on the report.
Template field properties
The template field has the following unique properties:
In most cases, you do not need to change the defaults for these properties.
- Name
- Name of a data variable. The data is specified when a report is created from the template.
- Type
- Type of data variable, for example, CHAR or INTEGER.
- Size
- Size of the data variable. The units depend on the type, for example, character types are in bytes or characters, while decimal types are in digits.
- Title
- Title of the template field.
- Role
- Determines what report element is created by the field. If this value is not specified, the template field creates objects based upon the data variable properties and contextual information.