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

I want to sort list 1 wich contains a few substring of list 2 in the order of list 2
and the elements wich doesn’t contains a substring of list 2 needs to be added at the and of the new list.

i tried a few options.
see image
but in this case i want the elements wicht contains “stoelpoot” behind the elements “stoeltest” and “stoeltr”

both lists can change in length and composition

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

Like so?

Hang on, this is better.


it needs to search for a part of string from list 1
for example if a part of a string in list1 contains the string “stad01” it needs to put that one at the top of the new list

i know i can get what i want if i use 6 times list.filter.byboolmask. but when the length of list 2 changes i need to change my graph

Maybe something like this?

1 Like

maybe this picture makes it better to understand what i want:

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



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…



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


“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?


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.