Skip to main content
Version: Java (Groovy)

len

The len method returns the length of the given input. This is useful in query strings where a user needs to get the size of a Vector or a Java array.

Syntax

len(values)

Parameters

ParameterTypeDescription
valuesbyte[]

An input array for which the length will be calculated.

valueschar[]

An input array for which the length will be calculated.

valuesdouble[]

An input array for which the length will be calculated.

valuesfloat[]

An input array for which the length will be calculated.

valuesint[]

An input array for which the length will be calculated.

valueslong[]

An input array for which the length will be calculated.

valuesshort[]

An input array for which the length will be calculated.

valuesLongSizedDataStructure

An input array for which the length will be calculated.

valuesT[]

An input array for which the length will be calculated.

Returns

A long-typed value representing the length of the input.

Example

The following example demonstrates the use of len within a query string. Note that we must modify the "IntegerColumn" name to "IntegerColumn_" with the _ suffix to allow the Deephaven engine to access the column's array representation.

source = emptyTable(10).update("X = i").groupBy()
result = source.update("LenX = len(X)")