IF Node → Merge Node: No Merge Data Found

Here’s another approach that does away with the Merge and uses a dummy Set instead:

This seems to actually work.

(Update: only seems to work sometimes)

This looks like a similar issue:

I just don’t understand why this isn’t an issue for everyone with conditional logic. It seems like a FI node is necessary that ignores one of the branches depending on the state of the IF.

I’ve replaced all the conditional flow with sub-workflows. That works as which ever branch is not empty is returned.

that is what i noticed also. if merge is set to LEFT or RIGHT join, it should not fail if joined input is emply

1 Like

Oh. Where do I set LEFT or RIGHT join in the Merge settings?

I’m seeing:

  • Merge By Fields
  • Merge By Position
  • Multiplex

Is there another option?

I am having the same issue, and have no clue on how to fix it.

This still isn’t set up like the example I gave. The way I showed, with 2 outputs from “True” in the first IF, and nothing coming out of the “False” in the 1st IF, is what I read elsewhere in the forum, and what worked for me.

When you select “Merge by Fields” you can find the options to “Enrich Input 1 (left join)” “Enrich Input 2 (right join)” etc. Those are critical to making this work, see the settings in the mockups I posted.

I did see that, and I’m sorry - I just don’t understand.
Why do you have an IF that is true for everything? What does that add?
When the sheet exists in your example, won’t the Merge receive no data for Input2 and therefore fail as before?

And where can you set ‘Merge by Fields’ - which node is that? The Merge Node?

Sorry - I see it now. Will try that out

OK - I guess I see it now. Because Input 1 is always there, it works.

Well, I guess that is one way to do it. You have to add an extra dummy IF every time tho.
Doesn’t that seem quite hacky?
Still, if it works, I guess it works.

If you were replicating this pseudo code where both paths generate different outcomes, would you need 2 extra IFs?

if (sheetExists) {
   renameExistingSheet();
} else {
   createNewSheetWithName();
}

I would really prefer to replace the Merge with a dedicated “FI” or “END IF” node that has 2 inputs - for the FALSE and TRUE branches. I looked at this briefly but could not see how to make it.

To me, yes, but that’s what I found that works and was recommended when I was trying to figure out how to do it, so it’s what I’m using! :laughing:

1 Like

Thank you so much. I’m very new here and really appreciate your help.

1 Like

I added a feature request to add a dedicated “END IF” node that would merge the TRUE and FALSE branches directly. I’d gladly work on this, if someone can give me a pointer - maybe another node (Merge?) that I could use as a starting point.

Having a similar problem here. I created simulated data to follow the FALSE path. (below)

Data flows through FALSE path correctly but then it’s not recognized in the Merge node. Any solution for this? Is it a known issue, or am I doing something wrong?

EP

It’s counterintuitive but there is a workaround as mmac described above. You add an IF prior to your IF, set to always true, always send output. Then you feed that and the outcome of the ‘real’ IF to Merge, and set it to enhance the output from the always-true IF. Apparently, then the merge will continue, even if the real IF returns nothing.

Another solution is to put your IF into a sub-workflow with 2 outcome branches. This is what I’m doing - it’s cumbersome but it works.

If, like me, you would like to see a more straightforward approach, can I ask you to please upvote the feature request?

Just adding my two cents here, because I’m wrestling with the same problem and it’s REALLY frustrating to have to work out some kind of clever, situation dependent, hard to document workaround for this behavior.

I understand that it’s a documented “feature” that MERGE after IF will trigger back execution. I even understand why that has to be true when merge is used in the various “combine” modes.

But I don’t see why that has to be true when using MERGE in “append” mode. In that mode, MERGE should take everything from the true branch then everything from the false branch. If there’s no input on one of those branches it shouldn’t care. And it certainly shouldn’t force/trigger an execution on that branch. I’d bet that append mode is the most common use case for an “IF/MERGE” structure.

So where do I submit a feature request to change the behavior of MERGE in append mode?

Lee

Hi all, I understand how frustrating this is and I am really sorry for the confusion the Merge node keeps causing. There is a number of feature requests around this, @ColinMacLeod just linked a request that would avoid having to use the Merge node in many cases: Dedicated "END IF" or "FI" node to merge TRUE and FALSE branches of IF node. Another suggestion for the Merge node itself is Merge node suggestion: add option to disable triggering of previous nodes.

You might want to leave your votes on these.

Personally, I’ve resorted to avoiding the Merge node and instead build sequential workflows in such cases, where the merge then happens in a Code node. An example would be available here: [Merge node] merging multiple outputs - #4 by MutedJam

Lastly, I know Jan is working on a way to avoid this behavior in the pull request mentioned in this thread: Merge (wait) seems broken - #3 by jan. This is at an early stage though and not fully tested yet. So there is no definitive ETA yet I am afraid.

Thanks for the update @MutedJam!
Since posting this, I’ve resorted to ignoring the issues and testing in “production” mode. It appears to “fix” it and it seems you can have multiple branches coming into any branch just as long as you don’t try to test each node.

1 Like