If output of prior node returns value then node1 to run if no values returns then node2 to run

Describe the issue/error/question

Trying to move data from one database to another, when data present in database 1 but not in database2, create node to run when data present in both database change node to run.
However both node running regardless of data presence

What is the error message (if any)?

no error message

Please share the workflow

(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: latest version
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]: default
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: aks

I already added if node, shows true branch as empty and false branch has value, even then nodes that are added after true are running too.

That’s because the merge node expects items on input1 which are not there on the false branch of your if node.
With that, the merge node tries to execute the true branch to get data on input1.

The compare datasets node is made for this kind of use case, and might be a nice way of simplifying your workflow and avoiding these problems.

This post has an example of how you might build a workflow around it. You’d just need to swap the Google Calendar nodes for database nodes.

I only have input from one node which returns true/false, can you elaborate on how to use compare datasets for the same.

when both value matches, I assumed the value return as same branch but its returning as different branch. Its not clear how compare datasets working

Looks like compare Datasets and if works the same way

Hi @Shalini,

I did not think your whole workflow through, so I do not know how you can use the compare datasets node in this case.

But for a quick fix, you probably just have to connect the “Return cursor and amount” node just before the merge node on the false branch directly to the “code” node after the merge node. Like this:

That would not merge the data from missing product count and changed count, we would need the count of both missing and changed and created in the other workflow as an output.