Skip to main content

sortedColumns

Selects columns from a table and presents them in the selected order.

This function is similar to columns. Both functions return a table region of selected columns, but sortedColumns presents the columns 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

  • COLUMN NAME (column or string)

    A column you wish to select.

  • COLUMN NAME (column or string)

    Optional. Another column you wish to select.

  • COLUMN NAME (column or string)

    Optional. Another column you wish to select.

Notes

  • You can select as many columns as required.

  • The input to each parameter can be a column variable or column name (string).

Examples

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

ID

Branch

Manager

Sales

COGS

otherExp

Profit

Row 1

1

Aberdeen

Andrew Gray

14,000

8,000

1,500

4,500

Row 2

2

Edinburgh

Emma Moore

33,000

19,000

3,500

10,500

Row 3

3

Inverness

Linda Barclay

16,000

8,250

1,500

6,250

Row 4

4

Glasgow

Louise Scott

32,500

17,750

1,700

13,050

This example uses column variables:

[[sortedColumns(Manager, Branch, Profit)]] 

The return value is this sorted table region:

 

Manager

Branch

Profit

1

Andrew Gray

Aberdeen

4,500

2

Emma Moore

Edinburgh

10,500

3

Linda Barclay

Inverness

6,250

4

Louise Scott

Glasgow

13,050

Note that the Manager column now appears before the Branch column (compare with original table). Also, note that the row names — the ID values from the original table — are also included.

To get the same output in a "Describe Row in Context" project, the ATL is:

[[sortedColumns(ManagerColumn, BranchColumn, ProfitColumn)]]