Within a loop, how can i count number of rows in each iteration and have a cumulative total?

Hi all,
I have a workflow that checks user access in SAP. To do this I have a loop that loops around a list of users roles and collects whether each roles provides access to a list of predefined tables.

Currently, I am downloading table access for all roles within a loop and then filtering on those which provide table access. However, I want to improve performance by exiting a loop once all of the required tables have been granted by a combination of the roles. (i.e. if the first 2 roles grant access to all 4 tables, there is no need to check whether the remaining 5 roles also provide access).

What I am trying to achieve is the following:

To run a workflow, a user requires access to 4 different tables.

Iteration 1 - Role 1 provides access to 3 of the required tables.

Cumulative total = 3

Iteration 2 - Role 2 provides no access to the required tables.

Cumulative total = 3

Iteration 3 - Role 4 provides access to 1 of the required tables.

Cumulative total = 4.

At this point, I want the loop to end because the required number of tables equals the cumulative total rows within the loop.

Please can anyone advise whether this is possible?


@taylorpeter55 you can use the Variable Condition Loop End node to stop a loop once a condition is met. You can use temporary table to collect the results you already have.

As an alternative you can try and build something with a Recursive Loop and define an end condition.


Hi @mlauber71,

Thanks for the info. I’ll take a look into these two options.


1 Like

@mlauber71 Just wanted to close this one out.

I went back to the drawing board and figured out that my workflow runs much better if i check all roles within one linear group of nodes, rather than check each one individually using a loop :slight_smile:

Thanks again for your response to my original post.



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.