Sorting a list by a sublist element

Hello all,

I am trying to sort this list in a very specific way. As you can see, the list is comprised of many sublists. Each sublist contains a single room element and a corresponding Department name. I would like to be able to sort this entire list (of sublists) by those department names for example, so that all “Circulation” rooms would come before “Police Department” rooms. I am essentially trying to match the Sort Order of my room schedules. If my sort order is set to room number, I would love to have a list in dynamo with all of my rooms in the exact same order as the schedule.

 

Thanks,

Eric

Sort Order

Use SortByKey

Thanks guys! Both of your solutions will work excellently. I appreciate it.