Iteration in services action doesn't stop when changing size of datasources

Hello Appfarm

i think i found a small bug into iteration in appfarm services.

here i’m deleting some duplicated elements in my datasource while i’m iterating on it. it seems like it doesn’t stop when ending . it’s not taking into consideration the new size of the datasource

small exemple here :

  • if i have 5 elements : A - A - A - B - B

  • Iteration 0 : cleans duplicates of A ==> New size of the table : 3 (A - B - B )

  • iteration 1 : cleans duplicates of B ==> New Size of the table : 2 (A - B)

it should stop here but it still does another iteration with that kind of error

image

Hi!

I believe this behaviour is by design. Programmatically, you have two kinds of For-loop iterations: “array.forEach” and “for (i=0;i<array.length;i++)”.

The first kind will change the number of iterations if an array-item is removed while iterating, whereas the last one does not.

I believe the Appfarm “For-each” is the second kind of looping.

Thank you for your answer. if it follow that rule then it’s logic :smiley:

Thanks