Skip to main content

columnsInRegion

Selects columns from a specific table region.

This function is similar to columns but has an extra parameter for specifying the table region to select columns from. The columns function interrogates the whole table.

The return value is a table region. If the region comprises a single column, Studio prints the return value as a punctuated list. If the region spans two or more columns, Studio prints an HTML table.

The output is always a table region, even if the printed output is a punctuated list.

Note

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

Parameters

  • REGION (table region)

    The table region to select columns from.

  • COLUMN NAME (column or string)

    A 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

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

[[

filteredData = filterRows(WholeTable, Sales, gt(30000))

columnsInRegion(filteredData, Branch, Manager)

]] 

The first line uses filterRows to get rows with a Sales value greater than 30,000. This ATL is assigned to a variable called filteredData. The second line uses this variable when calling columnsInRegion.

In this example, the selected columns are Branch and Manager. Column variables are given.

The return value is this table region:

 

Branch

Manager

2

Edinburgh

Emma Moore

4

Glasgow

Louise Scott

Note

The row names — the ID values in this example — are always included in the region.

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

[[

filteredData = filterRows(WholeTable, SalesColumn, gt(30000))

columnsInRegion(filteredData, BranchColumn, ManagerColumn)

]]