sortByRowStrings
Sorts a table region by sorting a single row's values in alphabetical order.
To achieve the opposite effect, use sortByRowStringsReverse 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 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') sortByRowStrings(inputRegion, '1002') ]]
The result is this sorted table region:
Branch | Manager | State | |
---|---|---|---|
1002 | Boston | Emma Moore | Massachusetts |
1003 | Los Angeles | Linda Barclay | California |
Note
The column order has changed from Branch–State–Manager to Branch–Manager–State.
To sort the region in alphabetical order, using the values in Row 1003:
[[ inputRegion = rowsInRegion(columns(Branch, State, Manager), '1002', '1003') sortByRowStrings(inputRegion, '1003') ]]
This changes the column order from Branch–State–Manager to State–Manager–Branch.
State | Branch | Manager | |
---|---|---|---|
1002 | Massachusetts | Boston | Emma Moore |
1003 | California | Los Angeles | Linda Barclay |
Note
In a "Describe Row in Context" project, the column variables are BranchColumn
, StateColumn
, and ManagerColumn
.