Match Values in Sublists

Hi everyone, my apologies if this was already posted, but i went through a lot of posts and none of these matches exactly the situation I have in my Dynamo script.

The issue I am facing is this:

I have two lists (List A and List B), that each consist of three sublists (List A consist of sublists 1A, 2A, 3A (last one is not fitting on the screen) and list B consist of sublists 1B, 2B and 3B). I would like to find matching values in this way:

  • compare values of sublists 1A and 1B and get boolean values of list 1A according to presence in list 1B
  • to be specific, as a result in case of comparing 1A/1B I expect sublist of 40 boolean values (true/false) according to the fact if the exact value in sublist 1A can be found anywhere in sublist 1B, so I later on I can filter it by boolean mask
  • perform this “matching of sublists” for 2A and 2B, 3A and 3B and so on as in the final situation the amount of “sublist-couples” will be variable

I managed to find solutions (in different project) for comparison of List with sublists and simple List without any sublists that works well (it was posted few times at this forum), but I am not able to advance it for this problem. I think it is mostly about data structure, but apparently I am missing something.

Please, does anyone know a solution for this problem? I dot not prefer any approach.

Many thanks for your help!

If your objective is to match the sublists and return the match (skipping the filterbybooleanMask operation) then you can try to:

  1. find the indexes of the B elements (shorter) on your A list (longer)
  2. get the elements of your A list based on those reported indexes

Amazing! It works exactly as I wanted. Thank you many times!