Collect block does not collect all items

hi, I’m using a flow which has a ‘for’ block followed by an ‘if’ block. Near the end of the flow I’ve joined both branches of the ‘if’ back together through an ‘evaluate’ block that uses the FQL $merge function which produces a single object. Now I tried collecting these objects in a ‘collect’ block, but it doesn’t work as expected.

As you can see in the screenshot, the ‘collect’ blogs appears to be randomly collecting items. At first, it collects data from 5 iterations before finishing, then it finishes after each iteration, collecting a single object each time.

I say “randomly” because the first time I ran this flow I joined the two branches of the ‘if’ block in a ‘record’ block instead of the ‘evaluate’ block that is in the screenshot and then the ‘collect’ block collected 3 iterations at once which coincidentally corresponded to the 3 iterations that came via the top branch. It then “collected” the other 7 separately.

Any idea if I’m doing something wrong or if something else is happening here?

Thanks!

Hi @jd-forem

Welcome to the forums!

A few questions:

  1. Is the data the same every time when it gives you a random number of collection iterations?
  2. Do you have more than one for loop in your flow?
  3. Are you able to show the logic with your If Block

hi @flows-daniel ,

  1. Yes, the two ‘record’ blocks make sure that the data is the same. Anyway, I’ve tested this separately and collecting sets of objects/records that are not the same appears to be working just fine.
  2. I do have two other for loops, which are much ‘simpler’ and just process arrays of strings and then collect again on a single branch. This part works fine. See the screenshot below.
  3. From the screenshot mentioned in point 2, the flow goes directly into the ‘for’ block and from there into a first ‘if’. On one of the branches there is a second, nested ‘if’ (see the second screenshot below).