|Available in: Logi Info|| Source code name: RepeatElements||Introduced in: v11.1.033|
Repeat Elements make it possible to dynamically replicate definition elements from rows of a child datalayer. This makes it easy for a definition to change based on a data query. For example, additional Data Table Columns can be added if a database schema query indicates that there are extra columns in a table.
Similar to @Data tokens, @Repeat tokens set attribute values from data for each of the repeated elements.
Repeat Elements should have one child datalayer element, and one or more other elements which will be repeated. Here is a simple example which lists Category Names. Note how the Label element's Caption is changed with each repeat.
<DataLayer Type="SQL" Source="SELECT CategoryName from Categories">
<Label Caption="Category Name: @Repeat.CategoryName~" />
Repeat Elements may be placed anywhere within a definition.
Repeat Elements can also be nested. The easiest way is to include an additional Repeat Elements below the first. This method works well as long as there are not too many Repeat Elements, each running its own datalayer.
To build nested repeated elements with a single datalayer, add the datalayer to the top-level Repeat Elements and set it up with a Group Filter element with Hierarchical="True". The lower-level Repeat Elements will automatically repeat based on the next hierarchical level.
<DataLayer Type="SQL" Source="Select Customers.ContactName, Customers.Country From Customers">
<GroupFilter GroupColumn="Country" Hierarchical="True" />
<Label Caption="@Repeat.Country~" />
<Spaces Size="5" />
<Label Caption="@Repeat.ContactName~" />