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
SpreadsheetSelectPlus(PSHEET_Spreadsheet, "A2", "B5")
SpreadsheetSortSelection(PSHEET_Spreadsheet, asAscending)
// Sorts the entire worksheet
// Selects a cell
PSHEET_Spreadsheet = "A1"
// Sorts all the rows and columns with data below and on the right
SpreadsheetSortSelection(PSHEET_Spreadsheet, asAscending)
IF ErrorOccurred = True THEN
Error(ErrorInfo())
END
// Sorts the selection according to different criteria
// Column A: Ascending sort
// Column B: Descending sort
SpreadsheetSortSelection(PSHEET_Spreadsheet, "A" + TAB + "B" + asDescending)
IF ErrorOccurred = True THEN
Error(ErrorInfo())
END
Syntax

Sorting the selection according to a sort criterion Hide the details

SpreadsheetSortSelection(<Spreadsheet control> , <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

SpreadsheetSortSelection(<Spreadsheet control> , <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: wd290obj.dll
Minimum version required
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help