Function Looping
In order to perform looping in outputs you need to:
- Add a looping setup call inside the output header.
- Add a looping content block inside the output body.
Header
In the header, you should call one of the looping setup methods. For example, if looping across multiple tenants in a tenancy from a tenancy screen output, you can use the following:
{{SetupTenants(1,ALIAS.CONCODE,2)}}
Note: The first parameter is the id used to identify the loop
Body
In the output body, you must surround the content you want to loop with the following tags:
{{LOOP([LOOP_ID])}}
Html Content
{{ENDLOOP}}
To output fields on the entry being looped you use the syntax:
@entry.[FIELD]
To output the entry being looped that does not have fields i.e. a list of email addresses you use the syntax:
@entry
Positions
You can use the following variables to check the current count and index within a loop:
v_LoopCount | The current count of entries in the loop. |
v_LoopIndex | The current index of the entry in the loop starting at 1. |
Example
The following example shows how you can loop across different tenants in a tenancy.
Header
{{SetupTenants(1,ALIAS.CONCODE,2)}}
Body
{{LOOP(1)}}
{{IF(v_LoopIndex > 1)}}
Name:@entry.CLCODEDESC, Address=@entry.ADDRESS, Created:{{DisplayDate(@entry.SDTIME)}}
{{ENDIF}}
{{ENDLOOP}}