How to get index of view name from excel list?


#1

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.


#2

Try and use longest lacing on your index of


#3

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


#4

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


#5

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.


#6

@bnydam42

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


#7

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


#8

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.


#9

Whoops, had a node mapped wrong…
Error is “Warning: Arguement is Invalid”


#10

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.


#11

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.


#12

Just tried all caps and that doesn’t work.


#13

I think this might be what you’re after:


#14

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’).


#15

I think I will need a test file :slight_smile: