List with Sublists were the sublists should have the order of an completely other List


#1

Hello everyone,
i have been working with Dynamo for a month roght now and ran into a Problem with sorting a list.
I did spend about 4 Hours on searching a trying diffenrent stuff out to make it work but without succes.

I have a List with sublists. I want all items in each sublist to follow the order of another list.
See the attached Picture. I did try a couple of solutions out as seen but it didnt work out.

Does anyone have a solution? i would like to have the order of the Fields from schedule.View and not an aphabetic order.

Thanks in advance.

Mark Friis


#2

what order are you trying to match?


#3

try:


#4

Steven
The Output from “List.FilterByBoolMask” ist a List with 670 Sublists. Each Sublist from this List contains 15 Parameters. These 15 Parameters are in a Random Order. My Goal is to have the 15 Parameters in each Sublist to follow the Order of the List from the Node “List.Transpose”. It should seem easy but somehow I cant get it to work.

Nico_Stegeman
Thanks for your Reply. Sadly It didnt work out. The Node “List.SortByKey” gives me the Error “The number of Elements are not Matching the number of Keys”. But hey now the Type of my values for the Input to the Node are not any longer a Problem. Maybe im now a step closer to a solution.


#5

please show a new picture


#6

Im trying to make see if it helps to make the number of keys equal


#7

try list levels


#8

Put Flatten node after List.FilterByBoolMask node.


#9

Nico-Stegeman
List Levels?

Robert
Flatten did make “List.SortByKey” work, but it did give me the wrong results


#10


#11


#12

here a explanation of list levels:
http://dynamobim.org/introducing-listlevel-working-with-lists-made-easier/


#13

and in youre case you need lacing set on longest


#14

Can you share your file?? Revit & dynamo file??


#15

Thanks for the Response.

I did read about the List.level and did try out diffenrent selections and did Change the Lacing to Long.

I did also see a Mistake in my Sublists. They each contained 16 Items. They should only contain 15 Items so filtered out one of the duplicates… So now ist 15 Items per Sublist.

I did also repeat the Fields from schedule.View so it now Looks exactly like the list i want to have from the Parameters.

Sadly the “List.SortByKey” now works… and it sorts the List in a diffenrent way… but sadly not in my way:


#16

Hi again,
after playing around i finally found a solution. My understanding of the node “list.SortByKey” was wrong.
After some research and testing I finally decided to use the Node “List.FirstIdexOf” for the “Keys”.
I used the Wrong-Order of the Parameter-Names to search the Index-Numbers of the desired “List”, to get the correct Keys for the Parameter-Names in the Node “List.SortByKey”.

Happy Weekend!