Does SetIntersection work with sublist?


#1

Hi Guys,
I have two lists and want to check matching sublist and extract the sublist into new list.
i tried Setintersection nodeblock but it seems to no the way what i want.
Could you guys help me or point out another way to do?
Thanks all


#2

Hello!

SetIntersection will check your sublist indices against each other: In this case, it will check List A’s zeroth index vs. List B’s zeroth index.

What you desire is List A’s zeroth index vs. List B’s first index? The native behaviour of this node won’t encapsulate this. It’s correctly showcasing that only 2400 and 650 are present in both sub-lists at Index 1.

There is a potential to play with Lacing to achieve what you want (Based off your desired result).


#3

@Sol_Amour
Thank for explaining to me. I think i need work around with lacing thing.
And find out the way to put just the matching sublist into a new list.


#4

Totally! It kind of all depends on how you gather your data in the first place - but have a look at Lacing and List.Flatten. Hard coding this is easy for a one-off - but building a repeatable solution that can be used going forward takes a little more logic.