SortValues

Sorts a list of values based on the specified data type and locale.

Format 

SortValues ( values {; datatype ; locale } )

Parameters 

values - any text expression or field that's a list of values separated by carriage returns.

datatype - a number that specifies the type of data to be sorted (see below). A positive value sorts in ascending order; a negative value sorts in descending order.

locale - the name of the locale whose sorting rules are to be followed (see below).

Parameters in braces { } are optional.

Data type returned 

text

Originated in version 

16.0

Description 

For a description of a list of values, see ValueCount function.

Each returned value ends with a carriage return, allowing lists to be easily concatenated.

For the datatype parameter, use one of the following values so this function can sort values appropriately. If you use no value or an unrecognized value, values are sorted as text in ascending order.

datatype

Sorts values as

1

Text

2

Number

3

Date

4

Time

5

Timestamp

For the locale parameter, use one of the following names to specify which locale's sorting rules are to be used. Sort order is determined by locale in the same manner as for sorting records (see Choosing a language for indexing or sorting). Specifying a blank or no value sorts based on the locale of the file that contains the calculation's relationship graph; an unrecognized value causes this function to return "?".

Supported names for locale parameter

Arabic

English

Hindi

Norwegian

Spanish_Traditional

Bengali

Estonian

Hungarian

Panjabi

Swedish

Bulgarian

Finnish

Icelandic

Persian

Swedish_Custom

Catalan

Finnish_Custom

Italian

Polish

Tamil

Catalog

French

Japanese

Portuguese

Telugu

Chinese

German

Kannada

Romanian

Thai

Chinese_Stroke

German_Dictionary

Korean

Russian

Turkish

Croatian

Greek

Latvian

Serbian

Ukrainian

Czech

Greek_Mixed

Lithuanian

Slovak

Unicode_Raw

Danish

Gujarati

Malayalam

Slovenian

Unicode_Standard

Dutch

Hebrew

Marathi

Spanish

Vietnamese

Example 1 

SortValues ( "34¶600¶18¶29" ; -2 ) returns 600¶34¶29¶18¶.

Example 2 

SortValues ( Product::Colors ) returns values sorted in the default order (as text in ascending alphabetical order) in a file in which the locale is English:

blue¶green¶GREEN¶red¶yellow¶

when the Product::Colors field contains red¶green¶blue¶GREEN¶yellow¶.