The entries (rows) in a dictionary can be iterated during the generation of reports, BOMs, and code (JSON, XML, etc.). A common scenario is to have product features in dictionaries and make this data available as technical specifications by creating a report. The report loops through all dictionary entries and can also make decisions about which features to include in the report depending on the configuration.
To setup an iteration, the following parts are needed:
•A repeater that creates the loop.
•An inclusion expression that controls the number of iterations.
•A value expression that reads a dictionary column and uses its value.
Repeater
The repeater is the position for a loop. The object that the repeater is created on and all its children are traversed for every iteration of the loop. Repeaters can be created in the tree structure of reports, items and code.
When iterating the entries of a dictionary the Type of the repeater shall be set to Loop while included which puts the Inclusion expression in control of the number of iterations.
Inclusion expression
To iterate through all the entries in a dictionary, the inclusion expression should return true as long as there are entries left to iterate over, and then return false. This is done by comparing the loop index, using the ActiveLoopIndex() method, with the number of keys in the dictionary, using the DictKeyCount() method.
Example
ActiveLoopIndex() < DictKeyCount("City")
Value expression
To read data from the current row during an iteration of a dictionary, the row's key value must be first found, which is done with the DictKeyByIndex() method. Once the key value is known the value columns can be read as is described in Read dictionary values.
Example
City[DictKeyByIndex("City"; ActiveLoopIndex()); City.Latitude]