Application icon

Sort Form

This statement is used to set or remove sort formatting from names in one or more fields, a named variable or a list of fields in a named variable. Which fields or text strings you are processing is discussed in Statement Source/Target Determination. The same topic describes the ability to treat each field or named variable as a list where each list component will be processed.

The supplied text fields may contain any of the escape sequences described in Escape Sequences.

The statement always treats the Multi Value Delimiter as a field separator regardless if as lists is set. The as lists setting provides the means of having an additional list delimiter.

There are seven modes to the statement:

Set for Sorting

This mode removes a leading article (listed in the Rename Exception Natural Sort Set) from the front of a field and moves it to the end. eg:

    The Allman Brothers Band --> Allman Brothers Band, The

Set for Non Sorting

This mode essentially removes sort formating eg:

    Allman Brothers Band, The --> The Allman Brothers Band

Set Last Name, First Name

This mode does nothing if the field already contains a comma. At its simplest, it looks for the last space in a field and flips the content. eg.

     Boogie Woogie Red --> Red, Boogie Woogie

If the field ends with a sequence in the Rename Replacements Sort Form Ignore Suffix set, it will not be considered part of the last name and it will be appended enclosed in parenthesis. eg. Assume Band is in the set:

    Ben Webster Band --> Webster, Ben (Band)

If the last name is preceded by a sequence in the Rename Replacements Sort Form Name Prefix set, the sequence will be considered part of the last name. For example assume the set contains di:

    Al Di Meola --> Di Meola, Al

If the field ends with an ignore sequence and starts with an article in the Rename Exception Natural Sort Set, it will be correctly flipped. eg.

    The Ben Webster Band -->Webster, Ben (Band, The)

If the field starts with an article in the Rename Exception Natural Sort Set and does not have a trailing ignore sequence, this mode is equivalent to Set for Sorting. eg:

    The Rolling Stones --> Rolling Stones, The

Set First Name Last Name

This mode does nothing if the field does not contain a comma. It looks for the first comma in a field and flips the content: eg:

    Red, Boogie Woogie --> Boogie Woogie Red

It will also restore bracketed components preserved by the Set Last Name, First Name function. eg.

    Webster, Ben (Band) --> Ben Webster Band

Remove Leading Article

This mode removes a leading article (listed in the Rename Exception Natural Sort Set) from the front of a field. eg:

    The Allman Brothers Band --> Allman Brothers Band

Sort Multiple Items
This function only applies to fields which may contain multiple values and to named variables. The source is treated as a list of items delimited by the multi value delimiter. Empty items, leading and trailing spaces and duplicates are removed. The items are sorted in ascending order.

Sort Multiple Items Excluding First
Same as Sort Multiple Items with the exception that the first item always remains first.


Field Selection Modes in Tables