Comparing two lists error

Hello!

I am having problem trying to compare two lists.

It should give me 2 true and 3 falses? Instead it gives me 5 falses…

If I make an unique list this happens

Hello @toni.mikkola …not sure but probably something could work…

1 Like

Hi @toni.mikkola ,

The reason you are not getting the results you expect is because you are comparing item1 from list1 to only item1 of list2, repeated until you have reached the end of list2.

You should do a cross-lacing comparison when you want to compare both lists, then simply use an List.AnyTrue node to get your correct results. (Or you could use the node List.Contains, the results will be the same).

2 Likes

Yes Daan… list contain could work…as when i use == its just gives false even with cross P when we compare elements

Daan, you mean like this?

1 Like

Does not work…am I doing something wrong?

Hello …set you list contain node to crossproduct

2 Likes

Yeah as sovitek mentioned set the lacing to cross-lacing OR set the item input to @L1.

1 Like

Thanks!

Finally it works =)

1 Like

Perhaps List.SetIntersection or List.SetDifference also work here (depending on your needs as output), i am not sure though if they allow comparing Revit elements though.

1 Like

yes Daan think its could work as well…but i normally just use list all indicies of

1 Like

Yeah, also a valid option. And as the saying goes: " All roads lead to Rome"

1 Like

hehe true :wink: :wink:

1 Like