Data Serialization Functions

Serialization functions convert the data into the form expected by the query in which the interaction is inserted. For example, if the interaction is used in a compact-form query, use the asObject function to format the data into a one-dimensional object.

Returns the date range filter condition as a string for a SAQL query. The date range is inclusive. Use the string as part of a filter based on dates.

The input data must be a one- or two-dimensional array. If the input data is a one-dimensional array with two elements, the function uses the first element as the minimum and the second element as the maximum. Null results in fieldName in all, which applies no filter.

To view an example of this function, see Date Range Filter Interaction.

ArgumentDescription
fieldName(Required) The name of the date field.

This example is based on the stepFoo source query. Assume that stepFoo.selection retrieves this row from the query.

Function:

Output:

See Also

Returns an equality or "in" filter condition as a string for a SAQL query. The input data must be a scalar, one-dimensional array, or a two-dimensional array.

If a single field name is provided, the returned string contains the in operator for a one-dimensional array, fieldName in ["foo", "bar"], or the equality operator for a scalar, fieldName == "foo".

If multiple field names are provided, the returned string contains a composite filter. For this case, a two-dimensional array is expected. The number of values in each array must match the number of specified fields.

If the input to this function is null, the function returns <fieldName> is null, where <fieldName> is the first field. For example, if cell(step1.selection, 0, "column1") evaluates to null, cell(step1.selection, 0, "column1").asEquality("field1") evaluates to 'field1' is null. If there are no selected rows, cell(step1.selection, "column1"), the function evaluates to <fieldName> in all.

ArgumentDescription
fieldName(Required) The name of the field.

These examples are based on the myStep source query. Assume that myStep.selection is:

Function:

Output:


Function:

Output:


This example illustrates how a lack of input data is handled. Imagine that myStep.selection resolves as

Function:

Output:


The next examples illustrate how null values and empty arrays are evaluated when present in the myStep.selection.

Function:

Output:

Function:

Output

See Also

Returns a grouping as a string. Can also return multiple groupings

The input data must be a scalar or one-dimensional array of groupings. Null results in a group by all.

To view an example of this function, see Group and Project Interaction.

Let's look at some examples where the selection determines the groupings in a SAQL-form query. These examples are based on the stepFoo source query. Assume that stepFoo.selection retrieves these rows from the query.

Function:

Output:


Function:

To make the interaction return multiple fields for the grouping, replace the cell interaction function with a column function and update the arguments.

Output:

See Also

Passes data through with no serialization. Returns data as an object that is an array of strings.

Function:


Function:

See Also

Returns the query expression and alias as a string that you can use to project a field in a query. The query expression determines the value of the field. The alias is the field label.

Use this function to write a foreach statement for a field projection. The function concatenates the query expression as and the field label in this format.

Here's a sample projection that rounds the price to two decimals and stores the result in the SalesPrice field.

In this sample, round(Price, 2) is the expression and SalesPrice is the field label.

This example is based on the stepFoo source query. Assume that stepFoo.selection retrieves these rows from the query.

Function:

Output:


Function:

Output:

See Also

Returns a range filter condition as a string for a SAQL query. The range is inclusive.

The input data must be a one-dimensional array with at least two elements. The function uses the first as the minimum and the second as the maximum. Null results in fieldName in all, which applies no filter.

To view an example of this function, see Range Filter Interaction.

ArgumentDescription
fieldName(Required) The name of the field.

This example is based on the myStep source query. Assume that myStep.selection retrieves these rows from the query.

Function:

Output:

See Also

Serializes a scalar, one-dimensional array, or a two-dimensional array as a string. Escapes double quotes in strings.

Function:


Function:

See Also