Skip to main content

I have a standard loop step in my zap.  The last record of the set of records is not being processed.  I originally set the loop as:

1. Lookup all google records where field_a = true

2. Loop

       2a. Lookup specific google record (kind of redundant, but I do this to get the specific record #)

       2b. Path

                 2b1   Path A - If field_b = “apple”, then process A

                 2b2   Path B - if field_b = “orange”,  then process B

                 2b3   Path C - if field_b = “pear”, then process C

                 2b4   Path D - if last iteration = “true”

                           2b4a - create audit record of # records processed

The audit record in 2b4a always contained 1 more record processed (via Total Iterations field) than records processed (per results in Paths A,B,C).This is confirmed by an audit of the data.

 

So, I tried this:

1. Lookup all google records where field_a = true

2. Loop

       2a. Lookup specific google record (kind of redundant, but I do this to get the specific record #)

       2b. Path

                 2b1   Path A - Always run

                           2b1a   Filter … If field_b = “apple”, then process A

                 2b2   Path B - Always run

                           2b2a   Filter … if field_b = “orange”,  then process B

                 2b3   Path C - Always Run

                           2b3a   Filter … if field_b = “pear”, then process C

                 2b4   Path D - Always Run

                           2b4a   Filter … if last iteration = “true”

                                       2b4a1 - create audit record of # records processed

I’m getting the same result … the audit record in 2b4a1 contains 1 more record processed (via Total Iterations field) than records processed (per results in Paths A,B,C).  Again, confirmed by auditing the data.

 

Any thoughts?

one additional comment to my post … it appears in all runs that the last record of the lookup set (aka loop iterations) is the record not being processed.


Hi ​@promctllc 

For us to have true context, post screenshots showing how your Zap steps are outlined and configured in EDIT mode with the field mappings visible.


Which steps specifically?  There are quite a few steps in the Zap.  That said, I’ve attached snippets on what I believe is helpful ... and hopefully on what is being asked for:

  • Lookup+Loop+Path flow
  • Loop config settings
  • 1) Path conditions and 2) Path Filter
  • Path Last iteration Filter
  • Zoomed out pic of entire flow

 

After noodling on this, I’m thinking I need to add the “last iteration” logic in each business logic path (which I have quite a few), then removing the “last iteration” path itself.  I did it the way I’ve described in this post as I am hoping I don’t need to replicate the “last iteration” loop in each business logic path.

 

Thanks again!


@promctllc 

Try using this Zap action: Looping - Create Loop from Line Items

Reason: The data returned from the GSheet step is returned as line items.


Thank you, Troy.  This is zap is the most used zap that I have.  I’d prefer not to “try” as that will take me quite a bit of time to change and test, but I will I that is the only viable option. 

In its current configuration, why would the loop work for all occurrences except the last one?


@promctllc 

Loops run in parallel unless programmed to run sequentially.

 

To test all looping iteration, the Zap must be turned ON and tested live.

Each Looping iteration will have it’s own Zap Run in the Zap Run history: https://zapier.com/app/history/

 

Help links for using the Looping Zap app: https://zapier.com/apps/looping/integrations#help

 

 


Troy, thank you for the clarification that each zap loop has its own zap history entry.  I did not know that.  

Now knowing that, I reviewed all loop iterations history results. I determined that I have an unexpected source data inconsistency that resulted in the last record coincidentally being “mis-processed” because it was the bad record; because it was the last record in the data set, I was going down the wrong analysis path.  :(  Had it been in the middle, I might have caught it earlier.

Thanks again for your input in this matter.  For debugging, it would be easier if the zap history was in the same order as the data.  So, I will research how to program to run sequentially.  I’m not sure of the pros/cons, but performance/throughput is not a concern for me.  If you know off-hand where I can look on how to do this, I’d appreciate it.

Thanks again, Troy!


@promctllc 

Info about sequential looping:

 


That’s great news, ​@promctllc! 🎉 I’m so glad you were able to get to the bottom of it with Troy’s help—​@Troy Tessalone for the win! 💪

Hopefully, that How to Do Sequential Looping Iterations in Zap Steps guide Troy shared will help with getting them to run sequentially. Let us know if you run into any hurdles on that. In the meantime, happy Zapping! ⚡️