Traverse through an array


I have data in array format in two different streams , I want to check whether the array elements of the 1st stream are present in the 2nd stream or not. How should I do that?

  1. [“1001”,“1003”]

  2. [“1001”,“1002”,“1003”,“1004”]

I have tried using map function after Merge Join and I am able to access the elements of any stream but cannot compare it with the elements of second stream. Can you please suggest how can I achieve this.


Hello @shreegeet

I’ve come up with a solution with a diff snap, that includes splitting the arrays… Please see the pipeline , unmodified view of the Diff snap contains elements that are present in the both arrays.
test3_2020_06_12.slp (10.5 KB)

Dimche Saveski

array1.filter((x,y,z)=> array2.indexOf(x) == -1).length > 0 ? ‘An element/s in array1 but not in array2’ : ‘All elements in array1 is in array2’