Skip to main content

cell

Selects a cell from a 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 cell and value together.

Note

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

Parameters

  • ROW NAME(string)

    The row name.

  • COLUMN NAME(string, column)

    The column. 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

You can give the row and column names as strings.

ATL in Script

Result

[[cell('Aberdeen', 'Sales')]]

14,000

[[cell('Inverness', 'COGS')]]

8,250

You can give a column variable instead of a column name (string).

ATL in Script

Result

[[cell('Aberdeen', Sales)]]

14,000

[[cell('Inverness', COGS)]]

8,250

Note

In a "Describe Row in Context" project, the column variables are SalesColumn and COGSColumn.

The first parameter can take any ATL expression that returns a row name.

ATL in Script

Result

[[cell(rowNames(max(Sales)), Manager)]]

Emma Moore

This ATL returns the name of the manager for the branch with the highest Sales figure.

Note that rowNames(max(Sales)) returns the row name for the cell with the highest Sales value.

Note

In a "Describe Row in Context" project, the column variables are SalesColumn and ManagerColumn.

Using cell and value to test data types

Suppose you use the cell function to select a cell in a "Describe the Table" or "Describe Row in Context" project. Although the returned printed value may look like a number, the cell function returns a cell, not a number or string.

To return the value of the cell, you can use cell and value together.

Important

Using cell and value together will return the cell's value with a data type of string. This is because the underlying CSV data in a table region is string data. If you want to convert this to an actual number, you can use the asNumber function.

This means that the result of using value with a cell is always a string.

Assuming the same "Describe the Table" project as above, Sales are printed as numbers but are returned as strings.

ATL in Script

Result

Notes

[[value(cell('Aberdeen', Sales))]]

14,000

The value of the cell is displayed.

[[isTypeNumber(value(cell('Aberdeen', Sales)))]]

false

The Sales figure is returned as a string, not a number.

[[isTypeString(value(cell('Aberdeen', Sales)))]]

true

The Sales figure is a string.