Question

Looping by Zapier -> mySQL update record

  • 17 November 2022
  • 8 replies
  • 394 views

Userlevel 1
Badge

Hi Zapier community

I am trying to perform a loop to update multiple records on mysql database. 

The idea is:

  • trigger the Zap everyday at a certain time
  • find the count of rows to update in mysql database (say X times) (step 2)
  • loop through all the records that match the conditions of step 2 with “Find Row via Custom Query” (step 6) in order to update the row (step7)

 

However, the zap only loops once. I’ve also tried to change the order to have the loop after step 6 so after the record is found and before the action is performed but same result, it only loops once. 

The loop knows to iterate the right number of times but only loops once as per history. 

 

I’m sure I’m just looping the wrong way but can’t figure it out...

 

Thanks for the help!

Elsa 

 

 


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

8 replies

Userlevel 7
Badge +12

Hi @stylebase, I’m sorry that you’ve been having trouble with your Zap.

To see what’s going on we need to know how the Looping step is set up. Could you please share a screenshot of the Looping action showing what’s in each of the fields? Don’t forget to remove or obscure any personal or private information in any screenshot you share in the community (eg full name, email address, etc).

 

Thanks!

Userlevel 1
Badge

Hi Danvers,

 

Sure thing:

 

 

 

 

Userlevel 7
Badge +14

Hi @stylebase 

Good question.

Each Loop will have it’s own Zap Run history details.

When you manually test a Looping step it will only run once.

 

Userlevel 7
Badge +11

Hey @stylebase!

Given that the MySQL integration only returns one row, it sounds like your approach should work, where you use Looping. But your results would suggest otherwise :(

Your best bet to get a definitive answer is likely to contact our Support team. They can dig in a bit more to see what’s going on behind the scenes.

In the meantime, we do have a feature request for MySQL, to return multiple rows. I’ve added your vote for that, so if/when it gets implemented you’ll be notified via email! 

Hi, any luck solving this?

Userlevel 1
Badge

Hi Troy,

 

Thanks for your answer, I understand that the test will only loop once, but the Zap run does the same (you can see that in the history, only 2 to 6 tasks run which is just the tasks of my Zap ie it never loops). 

 

Any idea how I can make sure it loops when scheduled instead of only running once?

 

Best

Elsa

Userlevel 7
Badge +8

Hi @stylebase 

 

First, to actually use the Loop, you have to map the values from the Loop to steps 6 and 7, otherwise you are mapping 1 value and so the loop will only run once. 

so the setup of the Looping by Zapier is incorrect. You need to find X amount of records, what is your search criteria? You need to insert the search criteria into the loop so it runs 7 times (like it shows in the first set of screenshots) and each time it would look for a new record. 
 

If you still need more help, you can share the search value of step 6 and the update value of step 7 so I can help you more.

 

Userlevel 1
Badge

Hi @MohSwellam 

 

Thanks a lot for your help. My issue is that SQL actions can only return one row.

What I am trying to do is return all the rows that have today’s date and a certain value in another column (status = PENDING) in a given field of the table. So my approach was to find the first match in the date and the status, run through the action, then update the status to DONE so that it wouldn’t find that same row again. 

 

I’m not sure if the looping can be done with mySQL. I can see how it can be done if I were to use google sheet but how inconvenient…

Otherwise I’ll have to trigger the zap every minute or so until no more rows are found, but again, quite inefficient in terms of task usage.

 

Let me know if you have any other ideas!

Best

Elsa