- 13 Dec 2023
- 4 Minutes to read
- DarkLight
Repeater Elements
- Updated on 13 Dec 2023
- 4 Minutes to read
- DarkLight
General
Repeater elements can be used to repeat portions of a Template.
Example: A repeater can be used to repeat a portion of XML code (i.e. one or more XML elements) in a template for every value of a Datasource field or every row of a table extracted from a Datasource object.
Properties
Every repeater element has the following properties:
Name | Description |
---|---|
Name | The name of the repeater element. This name will be displayed in the tree hierarchy of the content explorer of the Report Designer. |
Code | The code of the repeater element. There must be no other report element within the same report with the same code. The code is used to reference the report element from within a Template (see below). |
Condition | An optional condition Expression; if it returns True or 1 the condition is considered to be fulfilled and the portion encapsulated by the repeater element will be included in the report document and repeated. If it returns something other than True or 1 the portion encapsulated by the repeater element will be removed from the report document. If you leave this property empty, the condition is considered to be always fulfilled. The condition expression is evaluated after the preparation Actions of the repeater element have been executed. |
Preparation Actions | A list of Actions that will be executed before the repeater element will be processed. |
Fail On Filter Exception | Determines what shall happen if an exception occurs when executing a preparation action that performs a filter (e.g. because the value to which you want to filter does not exist). When enabled, an exception will be thrown and the report document creation will be cancelled; when disabled, the portion encapsulated by the repeater element will be removed from the report document. |
Levels
Every repeater element has one or more levels. The portion encapsulated by the repeater element will be repeated once for each cross product combination of all repeater levels.
Example: If you have two levels; one for the Datasource field Year (which has the values 2008 and 2009) and one for the datasource field Country (which has the values Austria and Germany) the cross product of these two values (2008/Austria, 2008/Germany, 2009/Austria, 2009/Germany) will lead to four repetitions of the portion encapsulated by the repeater element.
Properties
Every repeater level has the following properties:
Name | Description |
---|---|
Source | The type of source for the list of repeated values. Datasource Field. If you select this option you can select a datasource field whose values will be used for repetition. Expression. If you select this option you can enter an Expression that returns one or more values to be used for the repetition. Table Rows. If you choose this option, you can select a Datasource object to extract a table from. The repeater will then perform the repetition for every data row of that table. |
Datasource Field | The Datasource field from which to read values to repeat over. This property is only available if the Source is set to Datasource Field. |
Datasource Object | The Datasource object from which to extract the table rows to repeat over. This property is only available if the Source is set to Table Rows. |
Expression | The Expression that returns one or more values to be used for the repetition. This property is only available if the Source is set to Expression. |
Sort Order | None. If you select this option, the values of the datasource field will not be sorted and used in the order in which the datasource returns them. Ascending. If you select this option, the values of the datasource field will be sorted in ascending order. Descending. If you select this option, the values of the datasource field will be sorted in descending order. This option is not available if the Source is set to Table Rows. |
Value Name | The name of the internal variable that contains the currently repeated value which can be accessed in Expressions using a Repeated Value Placeholder. |
Fields To Filter | A list of datasource fields that shall be filtered to the repeated value when the portion encapsulated by the repeater element is repeated. This property is not available if Source is set to Table Rows, because no filtering will be performed in that case. If Source is set to Datasource Field and you leave this list empty, only the datasource field you specified in the property Datasource Field will be filtered. In most cases it is not required to specify any fields here unless you want to also filter fields in datasources different from the one from which the repeated values are read. |
Insertion
You can insert the placeholder for the repeater element by dragging and dropping the report element from the content explorer of the Report Designer into the template. You will then see a start and an end tag for the repeater element:
{{<code>}}
{{/<code>}}
Every content between the start and the end tag of the repeater element will be repeated for every cross product combination of the repeater. If the repeater is excluded from the report document (e.g. if the cross product is empty), the portion encapsulated by the start and end tag will be removed from the report document. The following screenshot shows an example of a repeater:
Repeater Element Reference in XML Template