Skip to main content

sortedRowsInRegion

Selects rows from a specific table region and presents them in the selected order.

This function is similar to rowsInRegion. Both functions return a table region of selected rows, but sortedRowsInRegion presents the rows in the selected order, not the order in your sample data.

Note

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

Parameters

  • REGION (table region)

    The region to select rows from.

  • ROW NAME (string)

    A row you wish to select.

  • ROW NAME (string)

    Optional. Another row you wish to select.

Notes

  • You can select as many rows as required.

  • You can input a row name (string) or an ATL expression that returns a row name.

Examples

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

Branch

Manager

Sales

COGS

otherExp

Profit

Row 1

Aberdeen

Andrew Gray

14,000

8,000

1,500

4,500

Row 2

Edinburgh

Emma Moore

33,000

19,000

3,500

10,500

Row 3

Inverness

Linda Barclay

16,000

8,250

1,500

6,250

Row 4

Glasgow

Louise Scott

32,500

17,750

1,700

13,050

Note

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

The input to the first parameter must return a table region.

[[

inputRegion = columns(Manager, Sales, Profit)

sortedRowsInRegion(inputRegion, 'Glasgow', 'Aberdeen', 'Edinburgh')

]] 

The first line uses columns to get a table region that comprises the Manager, Sales, and Profit columns only. This ATL is assigned to a variable called inputRegion. The second line uses this variable when calling rowsInRegion. The row names are given as strings.

The return value is this table region:

 

Manager

Sales

Profit

Glasgow

Louise Scott

32,500

13,050

Aberdeen

Andrew Gray

14,000

4,500

Edinburgh

Emma Moore

33,000

10,500

The row order (top to bottom) reflects the order of selection (left to right) in the function call.

Note

In a "Describe the Table" project, the column variables are ManagerColumn, SalesColumn, and ProfitColumn.