The loop runs n times

The scenario runs n times. I successfully create a set variable, and each time I add set variable +1 to it. I need the numeric value to be stored in the data store with each iteration, incremented by +1, and the previous value should be deleted. How can I achieve this?

The general idea is that the scenario receives an image from a webhook and processes it several times. I need to update the data in the data store by counting the number of scenario executions, constantly overwriting the number by adding one.

You can use an Increment module.

Make sure you set it to never reset so you can count between scenario executions.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

Thank you. It seems like it worked. But how do I reset the increment function value when the process is completed?
Безымянный13
Безымянный12

The increment module in the “never” status cannot be reset automatically, so unfortunately, this solution does not work for me.

I would suggest you to use an increment function, is a good choice for your use case:
image

You can reset the Increment module’s variable when needed using the Make API.

Alternatively, if you want to go the data store route, you’ll have to fetch the variable at the start of your scenario, and update the data store with the new value at the end.