rowsInRegion
Selects rows from a specific table region.
This function is similar to rows but has an extra parameter for specifying the table region to select rows from. The rows
function interrogates the whole table.
The return value is a table region. If this region comprises a single row, Studio prints the return value as a punctuated list. If the region spans two or more rows, Studio prints an HTML table.
The return value is always a table region, even if it's printed as a punctuated list.
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 | 33,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) rowsInRegion(inputRegion, 'Aberdeen', 'Glasgow') ]]
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 |
---|---|---|---|
Aberdeen | Andrew Gray | 14,000 | 4,500 |
Glasgow | Louise Scott | 33,500 | 13,050 |
Note
The row names — the Branch 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:
[[ inputRegion = columns(ManagerColumn, SalesColumn, ProfitColumn) rowsInRegion(inputRegion, 'Aberdeen', 'Glasgow') ]]