List.IndexOf gives -1 when it should give correct results

Hi everyone,

I am quite stuck on a (probably) small problem, but i just can’t figure it out!
I have 2 lists, both containing the same values and i want to match the second list to the first so that they are in the same order.

However, when i try to compare these two lists i am expecting “1 0”, but i am getting “-1 -1” (see screenshot). Both lists contain only strings and duplicating the lists in 2 code blocks seems to work just fine.

I already tried setting “readasstring” to true but to no avail (List. indexOf giving -1)

Kind Regards,
Daan

Files:
2021-10-08 Updating AsBuilt data from Excel to Revit.dyn (37.3 KB)
Zuidbuis AsBuilt Gegevens.xlsx (9.6 KB)

Try checking the string lengths of each list. List.IndexOf is working perfectly fine for me in 2.6.

1 Like

Hi Nick,

Had some problems with Excel so took a while before i could try this fix, but it does work!
Thanks a lot for the suggestion, that was indeed the problem (whitespace at the end)!

Change the Code block before Data.ImportExcel to a string. Try with setting value “true” to ‘readAsString’ input in the ‘Data.ImportExcel’ node.