Stopping a branch from execution with IF node

Hey folks!
I am a complete beginner so this might seem stupid :bowing_man:

So I’ll quickly describe what I am trying to achieve:
I want a singular output from this workflow.

  1. If a certain promotion is evaluates to true, (i.e the today is after or on start_date and today is before or on end_date) then I want the the true branch to run.
  2. If no promotion evaluates to true then I want false branch to run.

The problem lies in the fact that I want to merge the data with more date in a single step.

So essentially, how do I make sure that the workflow goes through the entire data and if the true branch executes even once, then do not execute the false branch. But if it doesn’t evaluate to true even once then execute the false branch once.

I’ll also attach sample data as I think this will provide some insight into my problem.

So the data will contain entries which evaluate to true and which evaluate to false at the same time. (In this case ID 1 and 3 will evaluate to true)

My n8n version is 1.58.0
I have self-hosted it using npm
The operating system is Ubuntu
The data is on Google Sheets
The execution process setting are default.

Thanks a lot!!! :grin: :grin:

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Hey @Dhruv_Kadam Welcome!

I wasn’t too sure what you were asking so apologies if this isn’t it but you could try bringing the “IF” logic into the “edit fields” node by using an expression.

Hey @Jim_Le!
Thank for your help. While your solution wasn’t exactly what I was looking for, I was able to use it to get the output I desired. I did something like this.

Again, thanks a lot for your help!!! :grin:

1 Like

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