Sort list 1 (wich contains a substring of list 2) according to the order of list 2

This should do it. This keeps the order intact regardless of sorting because it only takes the first match. (The warning is for unmatched elements.)

List.List.Sortby.Numbering op basis van een andere list.dyn (49.5 KB)

i did exactly the same as you did i get warning length list is not equal as length key

i tried it in revit 2018.3 and 2019

The list level should be set for the str input on String.Contains, not searchFor. You’re checking each individual string against all the searches. This way you can get the first match if there are more than one.

you are a genius
but it is the same result as my attempt :wink:
problem is stoelpoot and stoel
i like it that it is now grouped

List.List.Sortby.Numbering op basis van een andere list.dyn (49.5 KB)

Sorry, I forgot to remove that from my list. You would get rid of stoelpoot and only search for stoel. Since the list requires stoel to come before stoelpoot (which sorting will do) you don’t actually need both of them.

Edit: Actually it doesn’t even matter in this case, because it pulls the first match only, so there are no duplicates. It just doesn’t group stoelpoot separately.