Type Conversion Functions

This section describes expression language functions related to manual conversion of value types.

Function

Description

Result Type

Backend Support

Frontend Support

boolean(Object value)

Converts argument to a Boolean.

Boolean

Yes

Yes

dataBlock(Object value [, String charset])

Converts the value argument to a Data Block. Any non-string value is first converted to a string, and then to array of bytes using the provided charset (or UTF-8 if charset is not specified). Resulting byte array is packed into a Data Block and returned.

Supported character sets are listed in the appendix.

String

Yes

Yes

double(Object value)

Converts argument to a Double number.

Double

Yes

Yes

integer(Object value [, Integer radix])

Converts argument to an Integer number.

If a radix is specified, this function converts value to a string and parses it as a signed integer in this radix. In this case characters in the string must all be digits of the specified radix, except that the first character may be an ASCII minus sign ('-') to indicate a negative value.

Integer

Yes

Yes

float(Object value)

Converts argument to a Float number.

Float

Yes

Yes

long(Object value [, Integer radix])

Converts argument to a Long number.

If a radix is specified, this function converts value to a string and parses it as a signed long in this radix. In this case characters in the string must all be digits of the specified radix, except that the first character may be an ASCII minus sign ('-') to indicate a negative value.

Long

Yes

Yes

string(Object value [, String charset])

Converts value argument to a String.

To convert a Data Block value to a String, use the optional argument charset to specify the character set encoding of the Data Block. Supported character sets are listed in the appendix. The default value of charset is UTF-8.

String

Yes

Yes

timestamp(Object value)

Converts argument to a Date. If value argument is a number, this number is interpreted as a Unix timestamp, i.e. number of milliseconds since Epoch. If value is a String, an attempt is made to parse it according to commonly used date/time formatting patterns. If value is a Data Table, its first-row, first-column cell is converted to a date according to the above rules.

Date

Yes

Yes

type(Object value)

Returns the type of the value parameter. Type is a single-character string that is used to encode data table field formats, i.e. S for String, B for Boolean, I for Integer, L for Long, F for Float, E for Double, D for Date, T for Data Table, C for Color, and A for Data Block. For all other object types the returned value is O. Null is returned if value is null.

String

Yes

No

Was this page helpful?