Comparing Lists

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.

you could use transpose block as shown below

Hi @bombear1

Show us your lists.

Here is my workspace.

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

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

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

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

Try this :

1 Like

Could your first list contain duplicates?

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.

what about ?

1 Like