IF Node executes both conditions



Maybe i do something wrong or something is not working as expected.

The concept is i want to check if a file exists in an ftp directory.

I have a simple FTP Node that lists all the files from the ftp directory.

I then add a simple IF Node that checks if there is a file starting with x name.

If it finds the file execute true condition and continue the true workflow. If it does not find the specific file execute the false condition.

The problem is if it finds the file both true and false are executed because the false condition shows the items with the names that did not match the condition above.

How to work around this issue?


Example Workflow:

Hey @Mulen, I am sorry to hear you’re having trouble here.

I tried running your example workflow but the IF node appears to be working as expected here. None of the items sent to the false output actually starts with ddd from the looks of it:

Am I perhaps missing something here?

Yes sorry i maybe didn’t explain this well.

The items at false output are correct but i want the false output to not execute something else if the true output has items.

My case is i want to send an email afterwards to notify the receipients if the file exists or not.

Now both emails are sent.

How to prevent false output if true output has data to not be executed?

Okay I think I see what you have in mind :slight_smile:

So ideally your IF node would check something like “is there at least 1 item meeting the condition”. I can’t think of any way to achieve this with the IF node unfortunately, but you could use the trusty Function node to get such a count (and then use the IF node to split out your flow and send an email depending on whether there is 1 or more matching items). Like so:

The Count Matching Items node would only return a single item with the number of matches:

1 Like

Thanks it works.

1 Like