Sum value to a node SET every time a function runs

Hello folks,

I need a help with a workflow, here’s what I need:

I have a set node that initiates with value 0, then a have a switch node that redirects depending on the SET node value.

Every time a route runs, at the of it I need to sum 1 to the first SET node and in the next cycle another route will run, and so on.

Is it possible to do it only with SET nodes? or do I need a function at the end of each route? If so, could you send me an example?

Thanks

Hi @Luis_Felipe, welcome to the community. Would you mind sharing your workflow with us? It’s much easier to understand what you’re trying to achieve with that. Currently, I’m not quite sure what data you’re having and what you’re trying to achieve, unfortunately.

Hi @Niklas_Hatje, unfortunately I don’t have it now to paste here. I’ll try to explain the flow.

1º - Sheets node to read the data
2º - Split in Batches (1 per cycle)
3º - Set node set the variable “Count” to 1
4º - Switch node to redirect to route with value 1 (based on value on “Count”)
5º - Starts route 1
6º - Come back to split in batches
7º - Here I need something to set the “Count” to 2, and so on.

Then when the “Count” reaches eg 8 I need it to start with 1 again

Maybe $runIndex is what you’re looking for? It automatically counts the index inside the SIB node. Here’s a (maybe stupid) example:

Hope that helps :slight_smile:

Great, it looks like a good way. Is it possible to reset the index after certain route? If so, it’s solved

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.