Loop Block
Loop is workflow block to run inner steps until loop condition is passed.
Needs:
| Property | Description |
|---|---|
| LoopConditionContextStore | Context store on which the condition is evaluated. Must be XML and not _any, see below |
| LoopConditionXPath | Loop block loops until this condition is true |
Loop example of looping until no additional data is returned from API
Transform_SDprepares newSDrecord using predefined (ROOT package) transformationSD_Empty.- Loop’s LoopConditionXPath is configured as
number(/ROOT/SD/@i2) > 0 - Step SD/@i1i1 = S@i1**/**@i1 + 1 increases
/ROOT/SD/@i1value by+1 - Step@i2SD/@i2 = count(ApiResult/ROOT/ARRAY) sets count of ARRAY objects from context store ApiResult which is returned from workflow GitlabProject which calls paginated API.
!!WARNING!! Loop condition must be built on XML structure and type _any cannot be used at this moment.
- It is recommended to loop using Entity structure for loop condition and to store data,
- In case you haven’t your structure suitable for looping condition, you can use Entity
SDto store data.
Reasons (valid for version 2024.2.2):
-
I have tried loop using but it did not work. Value of context store is in each loop reset to original value so it cannot be used as incremental value and conditioned in loop condition.
-
Looping over
_anystructure, I could not use loop conditioncount(ROOT/ARRAY) > 0in loop condition even when the context store of type_anyhas been filled.- Workaround was to use Task update context and save value of
count(ROOT/ARRAY) > 0intoSDdata structure context store, for example into fieldi2.
- Workaround was to use Task update context and save value of
-
TODO: model both examples into test model and claim as bug.
