How to find a value in a List


I have two lists and I want to check if the List A has any value of List B in it. List A [a,b,c] and List B [c,d] then it should return  [c]. Also is there a way I can create a join based on contains feature. like List has 5 elements it matched one of the elements in list 2 then, it should create a join. if no element matchs then no join. if one or more element matches then join.


Official comment

  • Avatar
    Joel Stewart

    Hello! The example you're describing sounds exactly like the INTERSECTION function from Datameer. The link directs you to the documentation with an example. 

    As for the second part, I assume that by "join" you mean the logical union of the two LIST sets. Using your example, the output of List A [a,b,c] and List B [c,d] would be [a,b,c,c,d] if logically unioned. If that is the case, you can simply use an IF statement to check first if the INTERSECTION of the two LIST sets is empty. If it is empty, return an empty LIST; if it is not empty then return the union of the sets. 

    In Datameer, the logical union of LIST objects is done with the "+" operator. 

    Lastly, if you want to remove duplicates from the union set you can pass the resulting union set through the UNIQUES function.



Please sign in to leave a comment.