Problem with Merge (Keep Key Matches)

The node gets several results from another node and should only filter out those that contain a certain string.
Although the property input 1 and 2 match, the solution set is empty.
I would be grateful for a solution to this problem.


Welcome to the community @Marvin!

The node compares not the values in the parameter field on the node. It compares the values the properties with the given name have.

Thanks for the quick help
Okay, but is there a way to filter out from a result set only those where a parameter contains a certain string?

I have a way via merge multiplex to map the string to the result set and then check it in the if, but this is not an efficient solution to the problem. Is there a more optimized way?

Sorry, do not understand why you have to multiplex. Can you not do a simple “Keep Key Matches” and then an “If” after that?

how can i compare one parameter with a string in keep key matches? do you have an example how to set the propertys?

Sorry do not understand. You have two sets of data.

Input 1:

    user: "john1234",
    age: 35 

Input 2:

    userName: "john1234",
    fullName: "John Miller" 

If you want to merge them you set “Property Input 1” to “user” and “Property Input 2” to “userName”.

If you want to filter for anything you can simply afterward add an “If” node and there you can add a String-Condition. In the first value you can set the string and in the other one you set an expression to the property you want to compare it with.

1 Like

thanks that helpt me a lot

another question :stuck_out_tongue: how can I count how many results a node or if node produces, especially how many results end up in true or false

That can be done with $items(...) as described here:

That will simply return an array so you can simply use .length on it. An expression doing that could look like this:

{{ $items('Function', 0).length }}

$items should be defined by default or am I wrong?
but every time I get the ERROR: $items is not defined

Yes, it should be defined by default.

If you get an error you are probably not using a recent n8n version.