Branching flow on basis of number taken from user

I am taking input from user in a form field, no of hours, and on the basis of that,if hours is less than 48 i want to make one api call and then the subsequent flow and if number is more than 48 another route. Can anyone please help how to branch the flow on the basis of such condition?


If i get output1 from one flow, and output2 from another flow, now is it possible to make a function node such that both the outputs come as input in the function node, and i set msg.payload object on basis of some global variable?

for point 1 - yes you can use the switch node - very simple to have conditions in there and branch to different locations.

Yes i would use the change node to take the output of each node and put them into a global variable each), you could then use a function node to retrieve both variables and manipulate them how you like

You could also use the join node for this or the switch and change nodes to set the msg.payload.

Have a go and come back with the flow yu come up with and we can give you some more help


Can I save output of msg.payload which has array of objects in a global array and then make a function in which I can change msg.payload as that global array based on the condition. If that is possible, can you please help in how to 1. define global arrays from msg.payload result , 2. How to access that array and set to some other msg.payload?

P.S. I am a beginner in Node Red.

For the second one, rather than using context for joining the flows, have a look at the example on Joining Streams from the node-red cookbook which uses the join node, which keeps the flow of data more obvious.

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