I want to be able to execute branch even if output of comparison node is empty.
E. g. I compare existing data in DB with new fetched. And using Comparison node to extract only new data. So if there is new data — Comparison node output propagates data further. And everything is ok.
But if there are no new data — comparison node just stops.
And I want to put IF after comparison node. And if there is no new data — do one thing. And if there is new data — do something else.
I know how to implement it manually via Code.
But is there any way without manual coding!
P.S.
“Always output data” is enabled
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Perhaps you want to consider using a Filter node here (or multiple Filter nodes depending on your requirements)? This node provides functionality similar to the IF node, but only has a single output. Provided you enable the Always Output Data option it would continue the execution even if the comparison fails:
Hi!
Does Filter allows to filter on logic based on 2 inputs?
What I need in general:
Node 1 outputs e.g [1,2,3]
Node 2 outputs [1,2,3,4,5]
So Compare allows me to substract Node 1 from Node 2. And get result [4,5]
So everything works ok. Except when result of comparison is empty (when both lists are equal). In this case compare just stops execution.
Perhaps you can share a workflow demonstrating your problem? [1,2,3] wouldn’t be the typical data structure returned by an n8n node, so I suspect we might be missing something relevant here.
Hi! Sorry for confusion. Saying [1,2,3] I meant it in more general sense.
Here is example workflow. Upper shows case when flow continues execution after Compare node. And lower workflow shows case, when flow stops after comparison
The flow stops because there is no data coming out of the “In B only Branch”, In the test you are using if A==B then the data would be correctly routed to the “Same Branch”.
What is interesting though is always output data seems to always output on the first branch rather than all of them but at the same time if we did always output data it will likely lead to some very unexpected results.
I will create a dev ticket anyway to always output data on all branches and we can see what the outcome is.
My general thoughts is that Comparison behaves like set maths. I.e. if sets A and B are equal, then A - B should return empty set instead of returning nothing.
Let’s see what devs think about that