Hello! I’m new to n8n and trying to figure out a simple case with an if statement.
Describe the problem/error/question
Im trying to decide on multiple steps if I should do X or Y.
I try to avoid calling things when not necessary (ex. call is in time every time even host is not available) and I don’t like to duplicate “get bulbs and turn off / on” nodes
Real case:
Turn bulbs on when host is reachable and time is between X and Y otherwise turn the bulbs off.
You can’t refer to the nodes, that haven’t been executed. You will need to output both possible branches somewhere to refer to it later in the workflow
Change the first If Node’s condition to true/false to see how it works
Thanks @barn4k! I got it to work with the “No operation” node and defining each required value for the last “if” node also in each “variable” node. Although it feels weird to set values in each variable node because one node shouldn’t contain necessary a value from a different node.
So there is no way to prevent an error on non executed nodes. For example by default non executed nodes-return value would be an empty object?
Sad to hear, that makes the whole automation process unnecessary more complex and you have to keep this always in mind when building a workflow with if nodes.
Thanks anyway for the help and the solution, I appreciate it!