PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Various
  • Example of custom sort procedure
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Sorts a WLanguage array. The following sorts can be performed:
  • Sort a one-dimensional array of simple elements.
  • Sort a two-dimensional array of simple elements according to one or more columns.
  • Sort a one-dimensional array of classes or structures according to 1 or more members.
  • Versions 22 and later
    WINDEVWEBDEV - Server codeWindows Mobile Sort an array of records according to 1 or more items.
    New in version 22
    WINDEVWEBDEV - Server codeWindows Mobile Sort an array of records according to 1 or more items.
    WINDEVWEBDEV - Server codeWindows Mobile Sort an array of records according to 1 or more items.
  • Sort a one-dimensional array by specifying a comparison procedure.
Note: This function is equivalent to Sort.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Apple Watch This function is now available in Apple Watch mode.
WEBDEV - Browser code This function is now available in browser code.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Apple Watch This function is now available in Apple Watch mode.
WEBDEV - Browser code This function is now available in browser code.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Apple Watch This function is now available in Apple Watch mode.
WEBDEV - Browser code This function is now available in browser code.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
// Sort a one-dimensional array
MyArray is array of 2 int
MyArray[1] = 4
MyArray[2] = 1
ArraySort(MyArray, asAscending)
Trace(MyArray[1], MyArray[2])
// Displays "1" then "4"
// Sort a two-dimensional array on the 2nd column
ArraySort(MyArray, asAscending, 2)
// Sort a two-dimensional array on the 2nd column
// (ascending) and the 3rd column (descending)
ArraySort(MyArray, asColumn, "2;-3")
// Sort an array by using a comparison procedure
ArraySort(MyArray, asFunction, Compare)
// Comparison procedure
PROCÉDURE Compare(Element1, Element2)
IF Element1.Member < Element2.Member THEN RESULT -1
IF Element1.Member > Element2.Member THEN RESULT 1
RESULT 0
Syntax

Sorting a one-dimensional array of simple elements Hide the details

ArraySort(<Array Name> [, <Type of Sort>])
<Array Name>: Array
  • Name of Array variable to use. This array must be a one-dimensional array.
    This array can also correspond to an array of simple elements of an advanced variable ("Group" array in the gglContact variables for example).
  • Versions 19 and later
    Name of Associative Array variable to use.
    AndroidJavaPHP The associative arrays cannot be sorted in this version.
    New in version 19
    Name of Associative Array variable to use.
    AndroidJavaPHP The associative arrays cannot be sorted in this version.
    Name of Associative Array variable to use.
    AndroidJavaPHP The associative arrays cannot be sorted in this version.
<Type of Sort>: Optional integer constant
Type of sort to perform:
asAscending
(Default value)
Ascending sort.
Versions 19 and later
For an associative array: Sorting the elements of the associative array:
  • if the asKey constant is specified: The sort is performed in ascending order according to the keys. In case of equality between two keys, the values are sorted according to the ascending value if the values can be compared. If the values cannot be compared, the initial order is kept.
  • if the asKey constant is not specified: The sort is performed in ascending order according to the values. In case of equality between two values, the values are sorted according to the ascending key.
New in version 19
For an associative array: Sorting the elements of the associative array:
  • if the asKey constant is specified: The sort is performed in ascending order according to the keys. In case of equality between two keys, the values are sorted according to the ascending value if the values can be compared. If the values cannot be compared, the initial order is kept.
  • if the asKey constant is not specified: The sort is performed in ascending order according to the values. In case of equality between two values, the values are sorted according to the ascending key.
For an associative array: Sorting the elements of the associative array:
  • if the asKey constant is specified: The sort is performed in ascending order according to the keys. In case of equality between two keys, the values are sorted according to the ascending value if the values can be compared. If the values cannot be compared, the initial order is kept.
  • if the asKey constant is not specified: The sort is performed in ascending order according to the values. In case of equality between two values, the values are sorted according to the ascending key.
asDescendingDescending sort.
Versions 19 and later
For an associative array: Sorting the elements of the associative array:
  • if the asKey constant is specified: The sort is performed in descending order according to the keys. In case of equality between two keys, the values are sorted according to the descending value if the values can be compared. If the values cannot be compared, the initial order is kept.
  • if the asKey constant is not specified: The sort is performed in descending order according to the values. In case of equality between two values, the values are sorted according to the descending key.
New in version 19
For an associative array: Sorting the elements of the associative array:
  • if the asKey constant is specified: The sort is performed in descending order according to the keys. In case of equality between two keys, the values are sorted according to the descending value if the values can be compared. If the values cannot be compared, the initial order is kept.
  • if the asKey constant is not specified: The sort is performed in descending order according to the values. In case of equality between two values, the values are sorted according to the descending key.
For an associative array: Sorting the elements of the associative array:
  • if the asKey constant is specified: The sort is performed in descending order according to the keys. In case of equality between two keys, the values are sorted according to the descending value if the values can be compared. If the values cannot be compared, the initial order is kept.
  • if the asKey constant is not specified: The sort is performed in descending order according to the values. In case of equality between two values, the values are sorted according to the descending key.
Versions 17 and later
The sort type can be combined with one or more sort options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccRespectNumericArray sorted according to the order of numeric values.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreAccentArray sorted while ignoring the accented characters.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreCaseArray sorted while ignoring the case.
This option is useful for the arrays of character strings.
tccIgnoreSpaceArray sorted while ignoring the space characters found at the beginning and at the end of strings.
This option is useful for the arrays of character strings.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Array sorted while ignoring the space characters found inside the strings.
This option is useful for the arrays of character strings.
tccIgnorePonctuationAndSpaceArray sorted while ignoring the space characters and the punctuation characters.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
Versions 19 and later
asKey
New in version 19
asKey
asKey
Associative array sorted according to the key order. If this constant is not specified, the associative array is sorted according to the order of values.
This function is useful on the associative arrays only.
AndroidAndroid Widget JavaPHP The constants used to specify the sort options are not available.
New in version 17
The sort type can be combined with one or more sort options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccRespectNumericArray sorted according to the order of numeric values.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreAccentArray sorted while ignoring the accented characters.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreCaseArray sorted while ignoring the case.
This option is useful for the arrays of character strings.
tccIgnoreSpaceArray sorted while ignoring the space characters found at the beginning and at the end of strings.
This option is useful for the arrays of character strings.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Array sorted while ignoring the space characters found inside the strings.
This option is useful for the arrays of character strings.
tccIgnorePonctuationAndSpaceArray sorted while ignoring the space characters and the punctuation characters.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
Versions 19 and later
asKey
New in version 19
asKey
asKey
Associative array sorted according to the key order. If this constant is not specified, the associative array is sorted according to the order of values.
This function is useful on the associative arrays only.
AndroidAndroid Widget JavaPHP The constants used to specify the sort options are not available.
The sort type can be combined with one or more sort options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccRespectNumericArray sorted according to the order of numeric values.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreAccentArray sorted while ignoring the accented characters.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreCaseArray sorted while ignoring the case.
This option is useful for the arrays of character strings.
tccIgnoreSpaceArray sorted while ignoring the space characters found at the beginning and at the end of strings.
This option is useful for the arrays of character strings.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Array sorted while ignoring the space characters found inside the strings.
This option is useful for the arrays of character strings.
tccIgnorePonctuationAndSpaceArray sorted while ignoring the space characters and the punctuation characters.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
Versions 19 and later
asKey
New in version 19
asKey
asKey
Associative array sorted according to the key order. If this constant is not specified, the associative array is sorted according to the order of values.
This function is useful on the associative arrays only.
AndroidAndroid Widget JavaPHP The constants used to specify the sort options are not available.

Sorting a two-dimensional array of simple elements according to one column Hide the details

ArraySort(<Array Name> [, <Type of Sort>] , <Column>)
<Array Name>: Array
Name of Array variable to use. This array must be a two-dimensional array.
This array can also correspond to a two-dimensional array of advanced type (sort performed on an xlsDocument variable according to the values of a column for example).
<Type of Sort>: Optional integer constant
Type of sort to perform:
asAscending
(Default value)
Ascending sort
asDescendingDescending sort
Versions 17 and later
The sort type can be combined with one or more sort options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccRespectNumericArray sorted according to the order of numeric values.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreAccentArray sorted while ignoring the accented characters.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreCaseArray sorted while ignoring the case.
This option is useful for the arrays of character strings.
tccIgnoreSpaceArray sorted while ignoring the space characters found at the beginning and at the end of strings.
This option is useful for the arrays of character strings.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Array sorted while ignoring the space characters found inside the strings.
This option is useful for the arrays of character strings.
tccIgnorePonctuationAndSpaceArray sorted while ignoring the space characters and the punctuation characters.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
AndroidAndroid Widget JavaPHP The constants used to specify the sort options are not available.
WEBDEV - Browser code This parameter must necessarily be specified.
New in version 17
The sort type can be combined with one or more sort options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccRespectNumericArray sorted according to the order of numeric values.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreAccentArray sorted while ignoring the accented characters.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreCaseArray sorted while ignoring the case.
This option is useful for the arrays of character strings.
tccIgnoreSpaceArray sorted while ignoring the space characters found at the beginning and at the end of strings.
This option is useful for the arrays of character strings.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Array sorted while ignoring the space characters found inside the strings.
This option is useful for the arrays of character strings.
tccIgnorePonctuationAndSpaceArray sorted while ignoring the space characters and the punctuation characters.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
AndroidAndroid Widget JavaPHP The constants used to specify the sort options are not available.
WEBDEV - Browser code This parameter must necessarily be specified.
The sort type can be combined with one or more sort options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccRespectNumericArray sorted according to the order of numeric values.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreAccentArray sorted while ignoring the accented characters.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreCaseArray sorted while ignoring the case.
This option is useful for the arrays of character strings.
tccIgnoreSpaceArray sorted while ignoring the space characters found at the beginning and at the end of strings.
This option is useful for the arrays of character strings.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Array sorted while ignoring the space characters found inside the strings.
This option is useful for the arrays of character strings.
tccIgnorePonctuationAndSpaceArray sorted while ignoring the space characters and the punctuation characters.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
AndroidAndroid Widget JavaPHP The constants used to specify the sort options are not available.
WEBDEV - Browser code This parameter must necessarily be specified.
<Column>: Integer
Subscript of column where the sort will be performed.

Sorting a two-dimensional array of simple elements according to several columns Hide the details

ArraySort(<Array Name> , <asColumn> , <Columns>)
<Array Name>: Array
Name of Array variable to use. This array must be a two-dimensional array.
This array can also correspond to a two-dimensional array of advanced type (sort performed on a xlsDocument variable according to the values of one or more columns for example).
<asColumn>: Constant
asColumn: Constant used to sort a two-dimensional array of simple elements according to several columns.
Versions 17 and later
The asColumn constant can be combined with one or more sort options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccRespectNumericArray sorted according to the order of numeric values.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreAccentArray sorted while ignoring the accented characters.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreCaseArray sorted while ignoring the case.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
tccIgnoreSpaceArray sorted while ignoring the space characters found at the beginning and at the end of strings.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Array sorted while ignoring the space characters found inside the strings.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
tccIgnorePonctuationAndSpaceArray sorted while ignoring the space characters and the punctuation characters.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
AndroidAndroid Widget JavaPHP The constants used to specify the sort options are not available.
New in version 17
The asColumn constant can be combined with one or more sort options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccRespectNumericArray sorted according to the order of numeric values.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreAccentArray sorted while ignoring the accented characters.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreCaseArray sorted while ignoring the case.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
tccIgnoreSpaceArray sorted while ignoring the space characters found at the beginning and at the end of strings.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Array sorted while ignoring the space characters found inside the strings.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
tccIgnorePonctuationAndSpaceArray sorted while ignoring the space characters and the punctuation characters.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
AndroidAndroid Widget JavaPHP The constants used to specify the sort options are not available.
The asColumn constant can be combined with one or more sort options:
tccLexicographicOrderArray sorted according to the linguistic order.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccRespectNumericArray sorted according to the order of numeric values.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreAccentArray sorted while ignoring the accented characters.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
tccIgnoreCaseArray sorted while ignoring the case.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
tccIgnoreSpaceArray sorted while ignoring the space characters found at the beginning and at the end of strings.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Array sorted while ignoring the space characters found inside the strings.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
tccIgnorePonctuationAndSpaceArray sorted while ignoring the space characters and the punctuation characters.
This option is applied to all the columns on which the sort is performed.
This option is useful for the arrays of character strings.
WEBDEV - Browser code This constant is not available.
AndroidAndroid Widget JavaPHP The constants used to specify the sort options are not available.
<Columns>: Character string (with quotes)
List of columns in which the sort must be performed. The different columns must be separated by a semicolon. To specify the sort direction, the subscript of the column must be preceded by:
  • "+" (or nothing) for an ascending sort.
  • "-" for a descending sort.
    For example: "2,-3" to perform an ascending sort on the second column and a descending sort on the third column.

Sorting a one-dimensional array of classes, structures or records Hide the details

ArraySort(<Array Name> , <asMember> , <Members>)
<Array Name>: Array
  • Name of Array variable to use. This array must be a one-dimensional array. This array can be:
    • an array of classes,
    • an array of structures,
    • an array of advanced types,
    • Versions 22 and later
      WINDEVWEBDEV - Server codeWindows Mobile an array of records.
      New in version 22
      WINDEVWEBDEV - Server codeWindows Mobile an array of records.
      WINDEVWEBDEV - Server codeWindows Mobile an array of records.
  • Versions 19 and later
    Name of Associative Array variable to use. This array can be:
    • an associative array of classes,
    • an associative array of structures,
    • an associative array of advanced types,
      AndroidJavaPHP The associative arrays cannot be sorted in this version.
    • Versions 22 and later
      WINDEVWEBDEV - Server codeWindows Mobile an associative array of records.
      New in version 22
      WINDEVWEBDEV - Server codeWindows Mobile an associative array of records.
      WINDEVWEBDEV - Server codeWindows Mobile an associative array of records.
    New in version 19
    Name of Associative Array variable to use. This array can be:
    • an associative array of classes,
    • an associative array of structures,
    • an associative array of advanced types,
      AndroidJavaPHP The associative arrays cannot be sorted in this version.
    • Versions 22 and later
      WINDEVWEBDEV - Server codeWindows Mobile an associative array of records.
      New in version 22
      WINDEVWEBDEV - Server codeWindows Mobile an associative array of records.
      WINDEVWEBDEV - Server codeWindows Mobile an associative array of records.
    Name of Associative Array variable to use. This array can be:
    • an associative array of classes,
    • an associative array of structures,
    • an associative array of advanced types,
      AndroidJavaPHP The associative arrays cannot be sorted in this version.
    • Versions 22 and later
      WINDEVWEBDEV - Server codeWindows Mobile an associative array of records.
      New in version 22
      WINDEVWEBDEV - Server codeWindows Mobile an associative array of records.
      WINDEVWEBDEV - Server codeWindows Mobile an associative array of records.
<asMember>: Constant
asMember: Constant used to sort a one-dimensional array of classes, structures or records.
Versions 19 and later
For an associative array: The elements of the associative array are sorted according to the order of values for the specified members. In case of equality between two values, the values are sorted according to the ascending or descending key (according to the sort direction of the first member).
New in version 19
For an associative array: The elements of the associative array are sorted according to the order of values for the specified members. In case of equality between two values, the values are sorted according to the ascending or descending key (according to the sort direction of the first member).
For an associative array: The elements of the associative array are sorted according to the order of values for the specified members. In case of equality between two values, the values are sorted according to the ascending or descending key (according to the sort direction of the first member).
Versions 17 and later
The asMember constant can be combined with one or more sort options:
tccLexicographicOrderArray sorted according to the linguistic order.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
WEBDEV - Browser code This constant is not available.
tccRespectNumericArray sorted according to the order of numeric values.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
WEBDEV - Browser code This constant is not available.
tccIgnoreAccentArray sorted while ignoring the accented characters.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
WEBDEV - Browser code This constant is not available.
tccIgnoreCaseArray sorted while ignoring the case.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
tccIgnoreSpaceArray sorted while ignoring the space characters found at the beginning and at the end of strings.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Array sorted while ignoring the space characters found inside the strings.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
tccIgnorePonctuationAndSpaceArray sorted while ignoring the space characters and the punctuation characters.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
WEBDEV - Browser code This constant is not available.
AndroidAndroid Widget JavaPHP The constants used to specify the sort options are not available.
New in version 17
The asMember constant can be combined with one or more sort options:
tccLexicographicOrderArray sorted according to the linguistic order.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
WEBDEV - Browser code This constant is not available.
tccRespectNumericArray sorted according to the order of numeric values.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
WEBDEV - Browser code This constant is not available.
tccIgnoreAccentArray sorted while ignoring the accented characters.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
WEBDEV - Browser code This constant is not available.
tccIgnoreCaseArray sorted while ignoring the case.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
tccIgnoreSpaceArray sorted while ignoring the space characters found at the beginning and at the end of strings.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Array sorted while ignoring the space characters found inside the strings.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
tccIgnorePonctuationAndSpaceArray sorted while ignoring the space characters and the punctuation characters.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
WEBDEV - Browser code This constant is not available.
AndroidAndroid Widget JavaPHP The constants used to specify the sort options are not available.
The asMember constant can be combined with one or more sort options:
tccLexicographicOrderArray sorted according to the linguistic order.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
WEBDEV - Browser code This constant is not available.
tccRespectNumericArray sorted according to the order of numeric values.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
WEBDEV - Browser code This constant is not available.
tccIgnoreAccentArray sorted while ignoring the accented characters.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
WEBDEV - Browser code This constant is not available.
tccIgnoreCaseArray sorted while ignoring the case.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
tccIgnoreSpaceArray sorted while ignoring the space characters found at the beginning and at the end of strings.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
Versions 20 and later
tccIgnoreInsideSpace
New in version 20
tccIgnoreInsideSpace
tccIgnoreInsideSpace
Array sorted while ignoring the space characters found inside the strings.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
tccIgnorePonctuationAndSpaceArray sorted while ignoring the space characters and the punctuation characters.
This options is applied to all the members on which the sort is performed.
This option is useful for the "character string" members.
WEBDEV - Browser code This constant is not available.
AndroidAndroid Widget JavaPHP The constants used to specify the sort options are not available.
<Members>: Character string (with quotes)
Name of members used as sort criteria. If the sort is performed on several members, their names must be separated by a semicolon. To specify the sort direction, the member name must be preceded by:
  • "+" (or nothing) for an ascending sort.
  • "-" for a descending sort.
  • "." or ":" to perform a sort on chained properties.
    For example:
    - "Member1;-Member3" to perform an ascending sort on the Member1 member and a descending sort on the Member3 member.
    - "Source.URL" to perform a sort on the URL property of the Source property.
Versions 22 and later
WINDEVWEBDEV - Server codeWindows Mobile Sorting an array of records: Name of items used as sort criteria.
New in version 22
WINDEVWEBDEV - Server codeWindows Mobile Sorting an array of records: Name of items used as sort criteria.
WINDEVWEBDEV - Server codeWindows Mobile Sorting an array of records: Name of items used as sort criteria.

Sorting a one-dimensional array with a sort procedure Hide the details

ArraySort(<Array Name> , <asFunction> , <Custom WLanguage Procedure>)
<Array Name>: Array
  • Name of Array variable to use. This array must be a one-dimensional array. This array can be an array of advanced types.
  • Versions 19 and later
    Name of Associative Array variable to use.
    AndroidJavaPHP The associative arrays cannot be sorted in this version.
    New in version 19
    Name of Associative Array variable to use.
    AndroidJavaPHP The associative arrays cannot be sorted in this version.
    Name of Associative Array variable to use.
    AndroidJavaPHP The associative arrays cannot be sorted in this version.
<asFunction>: Constant
asFunction: Constant used to sort a one-dimensional array with a sort procedure.
<Custom WLanguage Procedure>: Character string (without quotes)
  • For a one-dimensional array: WLanguage procedure in the following format:
    PROCEDURE MyProcedure(Element1, Element2)

    This procedure is automatically called by the sort mechanism to compare the elements between themselves, two by two.
    If the element 1 must be found before the element 2 in the sort order, the procedure must return -1.
    If the element 1 must be found after the element 2 in the sort order, the procedure must return 1.
    If the element 1 and the element 2 are identical, the procedure must return 0.
  • Versions 19 and later
    For an associative array: WLanguage procedure in the following format:
    PROCEDURE MyProcedure(Value1, Key1, Value2, Key2)

    This procedure is automatically called by the sort mechanism to compare the elements between themselves, two by two. The comparison can be performed in the sort procedure according to the values or according to the keys.
    If the element 1 must be found before the element 2 in the sort order, the procedure must return -1.
    If the element 1 must be found after the element 2 in the sort order, the procedure must return 1.
    If the element 1 and the element 2 are identical, the procedure must return 0.
    New in version 19
    For an associative array: WLanguage procedure in the following format:
    PROCEDURE MyProcedure(Value1, Key1, Value2, Key2)

    This procedure is automatically called by the sort mechanism to compare the elements between themselves, two by two. The comparison can be performed in the sort procedure according to the values or according to the keys.
    If the element 1 must be found before the element 2 in the sort order, the procedure must return -1.
    If the element 1 must be found after the element 2 in the sort order, the procedure must return 1.
    If the element 1 and the element 2 are identical, the procedure must return 0.
    For an associative array: WLanguage procedure in the following format:
    PROCEDURE MyProcedure(Value1, Key1, Value2, Key2)

    This procedure is automatically called by the sort mechanism to compare the elements between themselves, two by two. The comparison can be performed in the sort procedure according to the values or according to the keys.
    If the element 1 must be found before the element 2 in the sort order, the procedure must return -1.
    If the element 1 must be found after the element 2 in the sort order, the procedure must return 1.
    If the element 1 and the element 2 are identical, the procedure must return 0.
Remarks

Various

  • This function cannot be used with the fixed arrays.
  • Dynamic array of variants: Only a custom sort (with a sort procedure) can be used.
  • This function cannot be used with the arrays of UNICODE strings.
  • To add an element into a sorted array, use ArrayAddSorted.
  • This function can be used on the arrays of advanced variables.
  • Versions 19 and later
    This function is available for the associative arrays.
    AndroidJavaPHP This feature is not available.
    New in version 19
    This function is available for the associative arrays.
    AndroidJavaPHP This feature is not available.
    This function is available for the associative arrays.
    AndroidJavaPHP This feature is not available.

Example of custom sort procedure

Example of procedure used to compare 2 integers:
PROCÉDURE MyProcedure(nInt1, nInt2)
IF nInt1 > nInt2 THEN RESULT 1
IF nInt1 < nInt2 THEN RESULT -1
RESULT 0
Example of a procedure used to compare two elements in an array of structures:
PROCÉDURE MyProcedure(stVar1, stVar2)
IF stVar1:nInt > stVar2:nInt THEN RESULT 1
IF stVar1:nInt < stVar2:nInt THEN RESULT -1
RESULT 0
Components
WINDEVWEBDEV - Server codeReports and Queries wd230vm.dll
Windows Mobile wp230vm.dll
WEBDEV - Browser code WDJS.DLL
Java wd230java.jar
Linux wd230vm.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Exemplo Array

tabListanumeros is array of 0 int
ArrayAddLine(tabListanumeros,10)
ArrayAddLine(tabListanumeros,5)
ArrayAddLine(tabListanumeros,2)
ArrayAddLine(tabListanumeros,20)
ArraySort(tabListanumeros,asAscending)
FOR x=1 TO ArrayCount(tabListanumeros)
SAI_array+=tabListanumeros[x]+CR
END
//Frances
tabListanumeros_f est tableau de 0 entier
TableauAjouteLigne(tabListanumeros_f,10)
TableauAjouteLigne(tabListanumeros_f,5)
TableauAjouteLigne(tabListanumeros_f,2)
TableauAjouteLigne(tabListanumeros_f,20)
TableauTrie(tabListanumeros_f,ttCroissant)
POUR x=1 A TableauOccurrence(tabListanumeros_f)
SAI_array+=tabListanumeros_f[x]+RC
FIN

//Blog com Video e Exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/02/curso-windev-array-001.html
De matos AMARILDO
Feb. 18 2016
sorting with a structure
ArraySort(arrayvariable,StructureVar,"Element1;Element2")
Andy <<cowboy>>
Jan. 12 2012