---
schema_version: "1"
id: 7b764f043653b36ad4e1925cc1019472361dc9b196e97319f1eea4f8e55f1e16
title: Interaction Functions
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_bindings/guides/bi-dashboard-bindings-functions-wave-designer.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-bindings/guide/bi-dashboard-bindings-functions-wave-designer.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: a793d680ca05dfff8fcb0f7e4a945d1ccc7eb28effc58337a59d582ab187a8e7
products:
  - Analytics Interactions
  - analytics
---
# Interaction Functions

Dashboard designer dashboards support a variety of interaction functions that get data from a source query, manipulate it, and serialize it to make it consumable by the target query.

If the input data has empty results, the function returns a null value. If the specified location of the data doesn’t exist, an error occurs. For example, the interaction is defined to get data from row 3, but row 3 doesn’t exist. An error also occurs if the shape of the input data doesn’t meet the requirement for the function.

Interaction functions operate on input data with one of these shapes.

- Scalar value, like `0`, `"this is scalar"`, or `null`.

- One-dimensional array, like `([1, 2, 3])` or `(["one","two","three"])`

- Two-dimensional array (an array of arrays), like `([ [1, 2], [3, 4] ])`

The required shape of the input data varies with each function. After processing the data, the functions can change the shape of the data.

Each interaction consists of nested functions. Each interaction must have one data selection function and one data serialization function. Optionally, interactions can have multiple data manipulation functions. This example illustrates how nested functions in an interaction work together to produce the expected result for a target query in which they’re defined. The example is based on this interaction.

```javascript
coalesce(cell(mySourceStep.selection, 0, \"grouping\"), \"state\")**.asString()**
```

The `mySourceStep` query has this input data.

| display       | grouping |
| ------------- | -------- |
| Regional Area | region   |
| Country       | country  |
| State         | state    |

Technically, the data for this query is stored as a two-dimensional array, where each row is stored as a map of key-value pairs.

```json
[
    ["display":"Regional Area", "grouping":"region"],
    ["display":"Country", "grouping":"country"],
    ["display":"State", "grouping":"state"]
]
```

At runtime, CRM Analytics evaluates the interaction functions, starting with the innermost function. Using that logic, CRM Analytics evaluates the example’s interaction functions in this order.

| Function | Description |
| -------- | ----------- |
| `mySourceStep.selection` | CRM Analytics returns each row of selected data as a map of key-value pairs. If a single selection is made, only one row returns. If multiple selections are made, multiple rows return.|
| `cell(mySourceStep.selection, 0, \"grouping\")` | The `cell` function returns a scalar value from the `"grouping"` column of the first row (indicated by the 0 index) returned by `mySourceStep.selection`. Based on the selection, the return value can be `"region"`, `"country"`, or `"state"`. If no selection is made, the function returns `null`.|
| `coalesce(cell(mySourceStep.selection, 0, \"grouping\"), \"state\")` | The `coalesce` function returns the value of the `cell` function if a selection was made. If no selection was made, the `coalesce` function returns the specified default value `"state"`.|
| `coalesce(cell(mySourceStep.selection, 0, \"grouping\"), \"state\").asString()` | The `.asString` function returns the result of the `coalesce` function as a SAQL string.|


**tip:** Use the `coalesce` function to provide a default value so that an error doesn’t occur when a null value is encountered.
