ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Spreadsheet functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Sorts the values selected in a Spreadsheet control.
Example
// Sorts the [A2:B5] cells of current worksheet
PSHEET_Spreadsheet.SelectPlus("A2", "B5")
PSHEET_Spreadsheet.SortSelection(asAscending)
// Sorts the entire worksheet
// Selects a cell
PSHEET_Spreadsheet = "A1"
// Sorts all the rows and columns with data below and on the right
PSHEET_Spreadsheet.SortSelection(asAscending)
IF ErrorOccurred = True THEN
Error(ErrorInfo())
END
// Sorts the selection according to different criteria
// Column A: Ascending sort
// Column B: Descending sort
PSHEET_Spreadsheet.SortSelection("A" + TAB + "B" + asDescending)
IF ErrorOccurred = True THEN
Error(ErrorInfo())
END
Syntax

Sorting the selection according to a sort criterion Hide the details

<Spreadsheet control>.SortSelection(<Options>)
<Spreadsheet control>: Control name
Name of the Spreadsheet control to be used.
<Options>: Integer constant (or combination of constants)
Sort options:
asAscending
(Default value)
Ascending sort.
asDescendingDescending sort.
tccIgnoreAccentSort while ignoring the accented characters.
tccIgnoreCaseSort while ignoring the case.
tccIgnoreInsideSpaceSort while ignoring the space characters found inside the strings.
tccIgnorePonctuationAndSpaceSort while ignoring the space and punctuation characters.
tccIgnoreSpaceSort while ignoring the space characters found at the beginning and end of strings.
tccLexicographicOrderSort based on the linguistic order.
tccRespectNumericSort while respecting the order of numeric values.

Sorting the selection according to several sort criteria Hide the details

<Spreadsheet control>.SortSelection(<Criteria>)
<Spreadsheet control>: Control name
Name of the Spreadsheet control to be used.
<Criteria>: Character string
Sort criteria in the following format:
"<Name column1>[;< Option>]" + TAB + "<Name column2>[;< Option>]" + TAB + ...
where:
  • <Name column> corresponds to the name of column to sort.
  • <Option> corresponds to a constant (or to a combination of constants) used to define the sort that will be applied to the column. If this parameter is not specified, the asAscending constant will be used. This parameter can correspond to:
    asAscending
    (Default value)
    Ascending sort.
    asDescendingDescending sort.
    tccIgnoreAccentSort while ignoring the accented characters.
    tccIgnoreCaseSort while ignoring the case.
    tccIgnoreInsideSpaceSort while ignoring the space characters found inside the strings.
    tccIgnorePonctuationAndSpaceSort while ignoring the space and punctuation characters.
    tccIgnoreSpaceSort while ignoring the space characters found at the beginning and end of strings.
    tccLexicographicOrderSort based on the linguistic order.
    tccRespectNumericSort while respecting the order of numeric values.
Remarks
  • The sort is performed on the current selection.
  • If a single cell is selected, the function searches for the best selection: all the rows and columns with data below and on the right.
  • If no sort can be performed, the ErrorOccurred variable is set to True and the error details are returned by ErrorInfo.
  • The first column is used as sort criterion.
  • The sort can be canceled by the user via Ctrl + Z.
Component: wd300obj.dll
Minimum version required
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/21/2023

Send a report | Local help