Get the item index number of a string within a list


#1

Hello,

I’m very new to Dynamo. …Is there a way find the index number of a string in a list? Here is a screen shot of my excel file.

Excel

 

 

 

 

 
The reason I am doing this is because the output excel file sometimes does not come in this order Apple/Banana/Grapes/Orange.
Some cases it would be Apple/Orange/Banana/Grapes etc. But I would always want the value of Banana whatever order it’s in. And then with the results
use the “List.GetItemAtIndex” node. Could somebody please point me to right direction. Any help would be appreciated…Thanks in advance

 


#2

Hi Paul,

Welcome to the world of Dynamo. Use “List.ContainsItem” with lacing to longest along with “FilterByBoolMask”. Good Luck!


#3

Hello KulKul,

Thank you!..I saw this but the word “item” threw me off so I did not try it out. I searched all the nodes that contain “List” and “String” in it. Good this will keep me going.

Thank you very much!

 


#4

No Problem, My pleasure!!!


#5

KulKul,

I’m getting different results. This is Revit 2015/Dynamo 9.0…Any ideas why?

Capture01


#6

Hi Paul,

Your List.ContainsItem needs lacing set to longest to match Kulkuls graph.

Udklip


#7

Martin,

Got it. Now it works. Thank you!..I didn’t even know about “Lacing” until I right click the node. I got a long way to go.

 


#8

No worries, Paul :-).

Lacing is confusing, and it takes time to understand :-).