Loop Block

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_SD prepares new SD record using predefined (ROOT package) transformation SD_Empty.
  • Loop’s LoopConditionXPath is configured as number(/ROOT/SD/@i2) > 0
  • Step SD/@i1i1 = S@i1**/**@i1 + 1 increases /ROOT/SD/@i1 value 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 SD to 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 _any structure, I could not use loop condition count(ROOT/ARRAY) > 0 in loop condition even when the context store of type _any has been filled.

    • Workaround was to use Task update context and save value of count(ROOT/ARRAY) > 0 into SD data structure context store, for example into field i2.
  • TODO: model both examples into test model and claim as bug.