Expression helpers

In addition to thestandard library modules,Workflows supports a number of other built-in helper functionssuch as for data type and format conversions.

For examples, see theSyntax cheat sheet.

Conversion functions

Convert values from one data type to another.

Functions
double()Accepts an attribute of type string or integer and returns a double.
int()Accepts an attribute of type string or double and returns an integer.
string()Accepts an attribute of type integer, double, or boolean and returns a string.

Data type functions

Operate on lists, maps, and strings.

Functions
in()Checks whether a given key is present in a list or map. SeeCheck existence of a key in a list orCheck existence of a key in a map.
keys()Accepts an attribute of type map and returns a list of key elements in the map.
len()

Computes the length of a value according to its type. Accepts an attribute of type list, map, or string and returns an integer.

  • Alist returns the number of elements in the list.
  • Amap returns the number of key-value entries stored in the map.
  • Astring returns the number of characters in the string.

Conditional functions

Support conditions within expressions.

Functions
default(val, defaultVal)

Returns a value if it is not null; otherwise returns a default value.

  • If notnull,val is returned.
  • Ifval isnull,defaultVal is returned.

You can usedefault with the standard library function,map.get, to safely access optional values in a map, returning null if the key is not found. For an example, seeRead map values.

You can also usedefault to access optional runtime arguments, and return a default value if the key is not found. For an example, see Access runtime arguments.

if(condition, ifTrue, ifFalse)

Evaluates a condition and returns one of two arguments depending on what the condition evaluates to.

  • Ifcondition evaluates to true,ifTrue is returned.
  • Ifcondition evaluates to false ornull,ifFalse is returned.

Note that arguments passed toif are always evaluated and that the function does not control processing flow. To conditionally execute an expression, use aswitch statement. For more information, seeConditions.

Type functions

Return data type.

Functions
get_type(arg)

Returns a string indicating the data type ofarg: one ofboolean,bytes,double,integer,list,map,string, ornull.

If the operand is a function or a subworkflow, aTypeError is raised.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.