Creative solution to an If --> Merge Problem?

I have not been able to brainstorm for a solution to this If → Merge workflow I’m working on.

The setup:

First a few “If” nodes that move data through or stop the process depending on the result. No problems there.

Then, we have an “If” that, if the result is “false,” we query MySQL for info. On the occasion that the MySQL node returns nothing (“Mock MySQL Results” shows what MySQL returns), I need to manipulate the data for the items in that are in the “IF blue” —> false results AND don’t have a result from MySQL. But since MySQL returns nothing, I can’t filter out the ones that return nothing AND are “If blue” —> false, in the Merge node, if that makes sense.

There are various workarounds I’ve used in the past for If —> Merge situations, but I can’t come up with a workaround for this case.

Any creative ideas would be deeply appreciated.

Please share your workflow

Hey @mmac,

I am not actually sure why you need the merge node there, If you are planning to process the data no matter what then you don’t need the If node or the Merge node so it could be that the workflow could be simplified.

I need to process the items that have no search results from the MySQL node. So I’m checking if something is in MySQL, and if it’s not, various actions need to happen down the line.

I am still not seeing why the merge is needed, if you need to work with something with no id from the query it would be from the false on the if. If you then need to work on the data that exists and the data that doesn’t you would do a merge later in the flow.

I guess the flow doesn’t have enough of your steps to get an idea of what is going on.

When MySQL returns no result after a search, it literally returns nothing, like this:


Nothing passes through to “False” because if a MySQL query doesn’t return results, there is nothing to pass through False.

So I have no way of knowing which items I need to process, since I have no way to compare the items that DID return results with the items that didn’t by merging the ones that DID return results with ALL the items queried, and then saving non-matches at the merge.

The flow here is exactly how it is. There is nothing missing.

Hey @mmac,

Where would the missing items be? I would assume they won’t be in the true branch so it could be that the merge is needed further back in the workflow or some more creative branching is needed. Using a split in batches node might help so you can loop items one at a time that way if it doesn’t exist you can get it from the split in batches node

The missing items don’t pass through, since MySQL returns nothing. The MySQL node is only producing 1 empty item (when the MySQL query returns no results) regardless of how many queries it cycles through, so I can go back to a previous node and get the data for 1 “false” result, but only for 1 of the items that passed through in the run. If I query 50 IDs in MySQL, all separately, and they all have no results, I will get 1 response from MySQL instead of 50, thus only being able to process 1 item down the line.

Like this:

Here is someone with a similar issue in terms of a “no results” MySQL query, however, the solution he is using doesn’t work for me: How can I validate with IF Block when MySQL Node returns nothing? - #6 by MutedJam

In my scenario I’m using a boolean true/false in the IF node to check if a item is present in the results, in the solution there provided by MutedJam he is using an “If field is empty” in his IF node. Either works, but again, since MySQL only returns 1 empty item, the remaining items in my queue don’t process.

Typically I use a Merge node to work around this, but in this case I haven’t been able to come up with a way to make it work. I don’t care whether I use a Merge node or not, I just need it to iterate though all of the the “False” items, not just one.

I’m assuming that the MySQL node when it gets 50 inputs, it is querying 50 times, so I’m not sure why it only returns 1 empty item, but that’s what it’s doing. I do not have “Execute Once” checked, and I do have “Always Output Data” checked.

I would look into using a split in batches node that way it won’t matter as much as you can always find the earlier item that returned nothing from that node as part of the loop.