In some workflows I need to feed the ouput of more than one node into another one, but the input nodes aren’t executed every time.
Think for example of a workflow starting with two different triggers.
I don’t want to duplicate paths.
If I use the || notation, it throws an error because one of the nodes isn’t exectured. Can I solve this with a Merge node. Or is there a better practice?
There is an expression function you can use to check if a node has executed.
Cannot find it right now as I am on my phone and connection is bad.
You should be able to find it though also on the forum there are some topics about it.
I think it is called {{ $('Node Name').isExecuted() }}, however the issue here is that you will still have 2 items meaning the node would execute twice, once for each of the incoming streams giving you a list. I reworked my solution to be a lot cleaner. If var1 executed the last set node will use that else var2 gets used
yeah that is it.
I only read the original question which was about 2 different triggers being used and wanting to check what trigger was the trigger for the workflow. Could have read it wrong though.
I am however interested in how the {{ $('Node Name').isExecuted() }} function could be used in a use case. In my last example, I did have to set the setting to always output a result from the Merge node to force it to continue.
The purpose of the Merge in my example is to simply bring two different streams of node executions into a single output containing both variables at best or at least of of them, in this case var2 will always return and var1 is “optional” based on the if condition.
Then from here, it’s very simple to use the || operator to decide which variables to work with. The trick i am using is to avoid having to check whether a previous node actually ran or not and only deal with what variables are available by the time we need to decide where to get variable values from. Hope this makes sense. This is how I understood your original question