I’ve already answered in your other thread, see there.
The same processes apply in each case, so this is a duplicate although I quite understand you weren’t to know that when asking. I’ll lock this thread and take any follow up questions on the sort by prototype thread as the only difference is the thing (attribute) being sorted upon.