How to get index of view name from excel list?

I have been trying to select a number of views from my project from a list of views pulled in from excel. I couldn’t get it work, even when inputting the name as a string. If I pulled in the index number of the view I was looking for, and fed that back into the Indexof node, it works…
So is an Element.name not a string? I also couldn’t use == to use a BoolMask.
I was finally able to get a result by using the Springs.Collector.Views but now I’m so mad I need to know what I’m doing wrong with the Indexof node.

Try and use longest lacing on your index of

Sorry, the main problem is that I can’t get Indexof to return results

Can you please upload your .dyn file and a sample .rvt file to test on? :slight_smile:

I will try and recreate this problem in a sample file when I get some time, but I get the feeling that I’m misunderstanding what my search terms are. It seems like the element name is not actually a string, which would explain why a string search does not work, but it that isn’t the case why is the output of Element.name labeled “String”? If it’s not a string what would it be?
Thanks.

@bnydam42

you can use StringFromObject to make it a string.
or use Object.Type to inspect it

You can use the node “Object.Type” for determining the type of output the nodes return.

Did not know about Object.Type, thanks. Unfortunately Element.Name is a System.String, as is the output of the pink group. The kicker is if I use StringFromObject on the string coming out of that group it no longer works with IndexOf.

Whoops, had a node mapped wrong…
Error is “Warning: Arguement is Invalid” Indexof%20Question%202

There seem to be a “upper case” / “lower case” difference between your “elements” and the “list” with which you try to find the “elements” in. To my knowledge the IndexOf is case sensitive.

Good catch. It seems that Revit capitalizes everything, even when they are not actually all caps. See the watch node in the pink box to confirm case.

Just tried all caps and that doesn’t work.

I think this might be what you’re after:

This returns the same results as before, it works with the results of the pink box (returns correct index), but not with a string of the same name (returns ‘empty list’).

I think I will need a test file :slight_smile:

1 Like