Skip to main content

len

Returns the length of a variable.

When the variable is a string, the function returns the number of characters.

When the variable is a list, the function returns the number of values.

Parameters

  • VARIABLE (string or list)

    The variable to find the length of.

Examples

The function returns the number of characters in a string.

ATL in Script

Result

Notes

[[len('Hello')]]

5

There are five characters in the string.

[[len('Hello, world!')]]

13

Whitespace characters are counted.

The function returns the number of values in a list.

ATL in Script

Result

[[myList = makeList(); len(myList)]]

0

[[myList = makeList('Linda', 'Kapila', 'Ashwinie'); len(myList)]]

3

Using len with table data

Assume a "Describe Row in Context" project with this data:

Branch

Manager

Sales

Row 1

New York

Eric Blair

1,204,851.24

Row 2

Boston

Elizabeth May

807,284.86

Row 3

Baltimore

Sam Clemens

756,912.75

Row 4

Pittsburgh

Mary Evans

1,029,563.48

Use a variable or ATL function to get a list of values, then use len to count the values.

ATL in Script

Result

[[RowNames]]

New York, Boston, Baltimore and Pittsburgh

[[len(RowNames)]]

4

[[rows('New York')]]

Eric Blair and 1,204,851.24

[[len(rows('New York'))]]

2

To count the characters in an individual cell, use the cell and value functions together.

ATL in Script

Result

[[cell('New York', ManagerColumn)]]

Eric Blair

[[len(value(cell('New York', ManagerColumn)))]]

10