Set Family Instance Type by an Excelsheet (Problem wit Sort List by Key)


im trying to set the family instance type of my foundation elements by an excelsheet.

It works fine, if i only have less then three elements where i want to change the family type.

But when if i try to do it with more then three elements i get an error from List.SortByKey (Key operation failed.Number of items does not match the number of keys) (Image is in the next post).

Where is my mistake?
In my opinion the number of items is equal to the number of keys.

Thanks for your help!

This happens when i use four elemnts for example:

@carspi in the first graph you are feeding 3 sublists and the Keys are 3 elements so its sorting correctly. on the other hand your second graph is sorting 3 sublists by 4 keys.

As far as I can see, you are trying to to sort by ids, why dont you use statements?

a == b ? elem : null

where a is the ‘a’ and ‘b’ value is revit and excel ids.

This post might inspire you if you want to use python instead!

Thank you, that was the tip i needed.
There was List.SortByKey node too much.

Now it’s working fine for me.

You are most welcome. great job

Please mark the thread as solved.