repeat (XLSX)
An Excel content command that iterates through all items of a Collection and produces a copy of the cells within the area of its host Name, cell contents included, for every item in the Collection. Any inline EL-expressions within the cells are evaluated on each round of the iteration, with one of the items of the Collection as a variable in the context for these expressions to make use of.
If repeat
's value
resolves into a Collection or Map with more than one item, the copies of the cells it will produce will be placed directly below the host Name's original area. If any cells already below the area (i.e. cells in the same columns but with higher row numbers) have any contents, those contents are pushed downwards as many rows as repeat
produces past the Named area's height in rows.
This attribute has a priority of 100.
Syntax:
repeat(value,var,varStatus,roundTest)
With required attributes only:
repeat(value,var)
Attributes
#1 - value | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | Collection, Map, Data Item | Yes |
This attribute defines the container whose contents the command will iterate through. While this container is primarily expected to be a Collection, two other types of values are also accepted. The three types are handled in the following ways:
|
#2 - var | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | No |
The value of this attribute defines the name of the variable that holds the current item of the loop, which inline EL-expressions in the copied cells may refer to. |
#3 - varStatus | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | No |
Defines the name of the variable that holds a Loop Status value. Loop Status has the properties Property |
#4 - roundTest | ||
---|---|---|
Required | Value type | EL-evaluated |
No | Boolean | Yes |
This attribute can be used to define a condition for skipping certain iteration rounds. This attribute's expression is evaluated at the start of every round and if it doesn't resolve into If undefined, no iteration rounds are skipped. |
Examples
As Excel content commands cannot exist within each other, inline EL-expressions are the only form of dynamic content that can be within this version of repeat. If "opportunities" was a Collection of Data items with Opportunity record data, the following repeat would loop over them:
repeat(opportunities,opp)
Then, in any of the cells within the Name's area, expressions like ${opp.Name}
and ${opp.Amount}
would bring the queried field values of the records into the cells.
The fourth attribute roundTest can be useful in limiting which data you wish to display. With this Collection of Opportunity data, we could limit it so that only Opportunities that are not closed are displayed by checking the value of the IsClosed field:
repeat(opportunities,opp,,!opp.IsClosed)