Index of returning -1

Hello Everyone,

I am new to Dynamo, I have an issue with indexof node which is returning -1.
When I connect list from list create is working fine but when I connect my list from element it shows -1.
Anyone knows what’s the issue?


Some thoughts
Is it a lacing issue. Set node to longest lacing.
Is one input a number and the other a string i.e. not the same.
Are there trailing white spaces?
Have you tried flattening both input lists?
Are you absolutely sure the items are contained in the list?

-1 means can not find that item. So there must be a mismatch.

Maybe also try uploading example script and Revit file for others to help later.

Edit: I would guess the output from the get parameter value node is a list of strings not numbers. You can convert them to number using a node I think

I tried both lacing and string to number and object but the result is the same -1
I flat, Transpose :grin: everything ! nothing happen

My guess: you’re comparing strings to integers or other mismatching data type. Check the data type for both sets of data with an Object.Type node.

1 Like

Hi @jacob.small,

you are right the type is different. but I tried to make both of them string but I was not successful.

if the type is different what should I do then?

@jacob.small,

Also, I found the node in clockwork package versionnumber.tointeger and make the type same as list but still did not work

I found the issue, when its make it to string, it added decimal, I removed the decimal and now its working

2 Likes