Why the can't i get the index of an item from a list in Dynamo Revit?

In Dynamo Revit, I have a list with sub-lists,
I want to get the list with the maximum items from each sub-list.
I got the count of each list, but when I try to get the index of the maximum item in the count, it returns null/-1/Empty List.
I have tried getting the Index Of node , AllIndiciesOf , and the FirstIndexOf.

Also, I tried getting the type of the object that is returned by the Maximum Item node and it is returning a double.
Here is a screen shot of the script

Did you check the count too? I would assume the count is an integer since it would always be a whole number. For this reason, it’s best to compare values when dealing with numbers. Use == instead or even a SortByKey if looking for the min or max.

Hi @MostafaTarekYassien ,

List.Count returns integers, List.MaximumItem returns Double(s), so when you try to compare them it won’t match. I recommend using List.SortByKey:

1 Like