Sort two different ordered lists


I’m trying to sort two given lists. I’m not so sure I can explain this well.

So as you see, I have two different lists, and they have some same values. The two lists need to be sorted in a same order. What I mean by that is List 1 needs to be S3, T6, C5… and List 2 also needs to be sorted S3, T6,C5… Since list 2 has a longer items, rest of them can be placed at the end of the list 2.

Thank you so much for your help and time in advance.

Hi @yjeong6 ,

I think this is what you are looking for:

This script finds the items in the second, longer list which do not exist in the first list (the List.SetDifference node output). Then this list is joined together with the original shorter list, to make sure the order is the same in both lists :slight_smile:

1 Like

Amazing. Yes! This Is what I needed. Thank you again.