cellInRegion
Selects a cell from a specific table region.
This function is similar to the cell function but has an extra parameter for specifying the table region for the target cell. The cell
function interrogates the whole table.
The return value is a table region. Studio prints the value in the selected cell; however, the return value is the cell object rather than the value itself. To get the value, use cellInRegion
and value together.
Note
Available in "Describe the Table" and "Describe Row in Context" projects only.
Parameters
REGION (table region)
The table region for the target cell.
ROW NAME (string)
The row name for the target cell.
COLUMN NAME (string, cell)
The column for the target cell. Either a column name (string) or column variable.
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 |
The input to the first parameter must return a table region.
ATL in Script | Result |
---|---|
[[ inputRegion = rows('Aberdeen', 'Glasgow') cellInRegion(inputRegion, 'Aberdeen', 'Sales') ]] | 14,000 |
The first line creates a variable (inputRegion
) that returns a table region of two rows.
The second line uses this variable for the first parameter when calling cellInRegion
. In this example, the input values for the second and third parameters, which specify the row and column, are both strings.
For the third parameter, you can give a column variable instead of a string.
ATL in Script | Result |
---|---|
[[ inputRegion = rows('Aberdeen', 'Glasgow') cellInRegion(inputRegion, 'Aberdeen', Sales) ]] | 14,000 |
Note
In a "Describe Row in Context" project, the column variable is SalesColumn
.