Skip to main content
Version: Java (Groovy)

sortDescending

sortDescending sorts rows in a table in a largest to smallest order based on the column(s) listed in the columnsToSortBy argument.

Syntax

table.sortDescending(columnsToSortBy...)

Parameters

ParameterTypeDescription
columnsToSortByString...

The column(s) used for sorting.

Returns

A new table where rows in a table are sorted in a largest to smallest order based on the column(s) listed in the columnsToSortBy argument.

Examples

source = newTable(
stringCol("Letter", "A", "C", "F", "B", "E", "D"),
intCol("Number", 6, 2, 1, 3, 4, 5),
)

result = source.sortDescending("Letter")
source = newTable(
stringCol("Letter", "A", "B", "A", "B", "B", "A"),
intCol("Number", 6, 2, 1, 3, 4, 5),
stringCol("Color", "red", "blue", "orange", "purple", "yellow", "pink")
)

result = source.sortDescending("Letter", "Number")