Step Execution Count

Hi Camunda experts,

I have a use case where I have to loop over a particular step x number of times. I can model this using a variable in the process to initially set and then increment the count variable for each execution (and later match it against x, which is a configurable property passed as a variable during process instantiation) but this involves setting a custom variable to maintain the step execution count. Wanted to check whether the process instance had an internal mechanism to store a particular steps ‘step execution count’ which could be used here?

Thanks,
Anant

Hi Anant,

it sounds like you want to use a multi-instance task or subprocess. You can specify the number of iterations using a static number, a variable or a condition.

Does this help you?

Greetings,
Philipp

Hi Philip,

The requirement is for a loop and as per the documentation on the same page, "or Multiple Instance the number of repetitions is known in advance - which makes it a bad candidate for loops (anyway - as it defines a completion condition that may already be sufficient in some cases).”. I was hoping that there is additional metadata with a process but it seems not to be the case.

Thanks,
Anant

Hi Anant,

just for clarification: if you know the number of iterations before (e.g. on process instantiation) then you can use a multi-instance task or subprocess with a variable. If you dont know the number before (i.e. do-while mechanism) then you need a loop which is currently not supported - see the open issue.

Feel free to create a pull request for it!

Greetings,
Philipp