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

So everything that’s not in the asked for list should be moved to the bottom of the list?

yes


Voila!

Not working
see also the disered order in red and blue in the previous image

So you want to have the rest sorted in order as well?
Guess I’ll have to be combining my two previous not-working solutions…


Voila?

yes

i my graph i have it working for the a great part but with the words “stoel” and “stoelpoot” it puts the word “stoelpoot” not at the disired location

almost

“huis” needs to become before “huis01” in the list

If you want to do both those things you’re in the same boat as I am now:

yep :grinning:

i have been watching that post
@jbo and @Jonathan.Olesen proposals are very interesting :+1:

All credit to @jbo, for the python snippet :slight_smile:

Something like this?

Almost

but now i have more items in the new list (19 in the original list and 23 in the new one) and in youre example one les.
And stil the strings wich contains “stoelpoot” become before “stoeltest” and that is not what i want.
I need the strings containing “stoelpoot” after strings that contains only “stoel” .
I know it can be done with a lot of times list.filterByBoolMask after eachother. But both list can change in length and than i have too change the graphs each time.

You don’t need multiple BoolMask nodes, you just need to use the proper list levels. The problem is that stoel is also going to return stoelpoot strings and stad is also going to return stad01 strings. It’s not a huge issue for stoel because you have stoel and stoelpoot in alphabetical order so you could probably just filter by stoel. But this is an issue when you have stad01 coming before stad.

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.