AnsweredAssumed Answered

Write a script for sorting by multiple values

Question asked by arobison1 on Jul 19, 2018
Latest reply on Jul 19, 2018 by arobison1

I have a button on my layout that, when clicked, should execute a script to sort the records.  I want it to sort by Country, then Last and First names within countries.  I seem to only be able to specify one field at a time in my script.  How can I do more?  I tried doing three in a row, but obviously it sorted three times by different criteria.

 

Just to clarify, something like this is what I want:

 

Last NameFirst Name
Country
FredericksAndrewAlgeria
FredericksBeatriceAlgeria
AndersonBillCameroon
HarrisBobCameroon
LawsonHarryCameroon
BradleyJimGermany
CrowsonCarlGermany
McCulloghIsaacHaiti
RobisonAndrewUnited States
SmithJohnUnited States

 

So the countries are alphabetized first, the last names within countries, then by first name when last names are shared.

Outcomes