How to Get the Index of the List

Hi,

Single Revit model for all services model. Trying to build script inserting views onto relevant sheets using xls to input views. Need help at this point. when i’m trying to get the index value of these list of views it’s returning -1 value. Script screenshot attached . TIA.

1 Like

check the list lacing, you can also try flatten :slight_smile:


Still returning -1 :frowning:

2022-04-07_11h15_51

reset it to default!

imputs are at the correct level… …there is no need of final lacing

still the same.

I think it’s because of Letter case index does not match. Try to string match will work if the case is equal.

1 Like


you mean like this? :slight_smile:

This will work I think!

1 Like

Still…

One has a space before the dash, the other doesn’t. They have to be an exact match.

The == node you’ve used will compare by index. It will go down each list and compare the items in index 0, returning true or false, then index 2,3…etc. So if your ‘MECH PLAN 3’ isn’t in the same index in both lists it will always return false.

If you want to look for a match anywhere in the list, you’d need to use a map function or cross product lacing, then either a List.Contains true, or a node like AnyTrue from Clockwork. You could then use List.AllIndicesOf to get those indices, but that’s a really long way around just using the List.IndexOf node.

1 Like

Think you coiuld use list equal as well