Comparing Lists

dynamo

#1

Hello everyone!

My goal is to filter a certain list, based on what element is presented in an other list.

I came up with an idea, where I compare each element of the second list with all elements of the first list one by one.

Since I don’t know the length of my second list, this is clearly not the best way of doing it.

I have two questions:

  • Am I going on the right direction, or is there a better way to solve it?
  • If this is the way to go, what is the right code in the codeblock, so I don’t need to add an entry for all the possible elements of the second list.

#2

you could use transpose block as shown below


#3

Hi @bombear1

Show us your lists.


#4

Here is my workspace.

The yellow says: The index if out of range. (OFC it is)


#5

What is that @L1, and how to do it?


#6

by click on right side arrow of the input, then check use level

this feature let you decide to deal with the whole list or sublist or sub-sublist … what ever the case you have
help23


#7

This is close to what I need, but at the end I only want TRUE-s, where it found the matching elements. So basically i need to merge the result lists, keeping all the TRUE-S


#8

Try this :


#9

Could your first list contain duplicates?


#10

Yes, I forgot to mention. It does not contain duplicates.

By the way, I was able to achive the desired result with some ugly workaround (based on my first codeblock), but I’m pretty sure, the solution what is posted by @khuzaimah.ElecEng is working. I’ll try it on monday.


#11

what about http://dictionary.dynamobim.com/#/BuiltIn/Action/SetIntersection ?