Skip to main content

sortByRowStringsReverse

Sorts a table region by sorting a single row's values in reverse-alphabetical order.

To achieve the opposite effect, use sortByRowStrings instead.

Note

Available in "Describe the Table" and "Describe Row in Context" projects only.

Parameters

  • INPUT TABLE (table region)

    The table region to sort.

  • SORTING ROW (string)

    The row to sort by. Give the row name as a string.

Examples

Assume a "Describe the Table" project with this data:

ID

Branch

State

Manager

Sales

Row 1

1001

Pittsburgh

Pennsylvania

Andrew Gray

478,745.37

Row 2

1002

Boston

Massachusetts

Emma Moore

329,493.49

Row 3

1003

Los Angeles

California

Linda Barclay

467,359.45

Row 4

1004

Chicago

Illinois

Camilla Scott

463,603.17

Note

The first table column — ID in table above — contains the row names.

To get a table region comprising the Branch, State, and Manager columns for Rows 1002 and 1003 only:

[[rowsInRegion(columns(Branch, State, Manager), '1002', '1003')]]

The result is this sorted table region:

Branch

State

Manager

1002

Boston

Massachusetts

Emma Moore

1003

Los Angeles

California

Linda Barclay

To sort this region in alphabetical order, using the values in Row 1002:

[[

inputRegion = rowsInRegion(columns(Branch, State, Manager), '1002', '1003')

sortByRowStringsReverse(inputRegion, '1002')

]]

The result is this sorted table region:

State

Branch

Manager

1002

Massachusetts

Boston

Emma Moore

1003

California

Los Angeles

Linda Barclay

Note

The column order has changed from BranchStateManager to StateBranchManager.

To sort the region in alphabetical order, using the values in Row 1003:

[[

inputRegion = rowsInRegion(columns(Branch, State, Manager), '1002', '1003')

sortByRowStringsReverse(inputRegion, '1003')

]]

This changes the column order from BranchStateManager to BranchManagerState.

Branch

Manager

State

1002

Boston

Emma Moore

Massachusetts

1003

Los Angeles

Linda Barclay

California

Note

In a "Describe Row in Context" project, the column variables are BranchColumn, StateColumn, and ManagerColumn.