Check if previous IF Node returned True or False Branch

Describe the problem/error/question

I have a setup where a IF Node checks for a condition and then BOTH True & False need to go into the next MySQL Node. This node needs to set a specific value based on if the data is coming from the True Branch or the False Branch. How can I check which Branch of the previous IF Node sent the data?

What is the error message (if any)?

None

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: latest
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu

@sg_tech , using IF node in this capacity yields no benefit. You can remove it completely. The condition you use in IF node could be utilized in MySQL node instead. Something like this,

{{ $json.isShipADestroyer ? 'INSERT A' : 'INSERT B'  }}

That is if $json.isShipADestroyer evaluates to true ‘INSERT A’ will be executed, otherwise ‘INSERT B’.

1 Like

:slight_smile: I ended up using this workaround. I will mark you answer as the right one…

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