cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Find unmatched data using join

kumar25
New Contributor II

Hi,

I have 2 input streams, i used inner join and fetched the matching data, also to capture the unmatched data i used- Unmatched data to error view option.

I am able to find the get the unmatched/additional records from the left path. How can i get the similar records of the right path.

Below is the input i used. Want to get unmatched record from input-2 

 

Input-1

[
    {
        "id""1",
        "team""ABC"
    },
    {
        "id""4",
        "team""SSS"
    },
    {
        "id""5",
        "team""AAA"
    }
]
 
Input-2
[
    {
        "location""India",
        "team""ABC"
    },
    {
        "location""Canada",
        "team""SSS"
    },
     {
        "location""Germany",
        "team""MMM"
    }
]
3 REPLIES 3

koryknick
Employee
Employee

@kumar25 - I suggest you use Outer join type and use a Router to see which records matched based on missing key values

kumar25
New Contributor II

Thanks @koryknick 

alchemiz
Contributor III

Hi @kumar25 ,

If both input streams are array you can use below script which outputs all the unmatched object in $['input-2'] 

$['Input-2'].filter((a,b,c)=> ($['Input-1'].find((x,y,z)=> x['team'] == a['team']) || null) instanceof Null)

alchemiz_0-1709289519056.png

Thanks,

EmEm