Datastore
Use the datastore node to perform actions on the system log or a datastore that you have created in the Content section of Studio.
The icon for the datastore node in the call flow editor is enhanced when the selected datastore is the system log.
How-To Video
Name
Give the node a name.
Datastore
The system log is selected by default.
Alternatively, select from any of the datastores in the Studio account.
Action
The insert action is selected by default.
The datastore accepts all UTF-8 characters.
Action |
Description |
---|---|
Insert |
Insert a row in the datastore with data from the call flow. |
Fetch |
Fetch values from a datastore. Add these values to variables in the call flow. |
Update |
Update a row in the datastore with data from the call flow. |
Delete |
Delete a row from the datastore. The datastore node cannot delete a row from the system log. |
Insert Action
Insert a row in the selected datastore.
-
From the Action menu, select Insert.
-
Select Debug Logs to insert a debug log while debug logs are enabled.
To enable debug logs, see Task Properties.
For more information on debug logs, see Debug Logs.
-
Insert values.
For each datastore column, click the pencil to the right of the Value field. This will open the Expression Builder.
-
Optionally, select a variable to store the inserted row ID.
If the variable has not been created yet, type the name of the variable in the field.
Fetch Action
Fetch values from the selected datastore. Add these values to variables in the call flow. For example, you may want to forward customer phone numbers to a sales representative.
-
From the Action menu, select Fetch.
-
From the Row Limit menu, select the maximum number of records to return that match the query condition, or select no-limit.
-
Build the Query Condition.
Following are some general guidelines to help you build the query condition.
-
Click Add Node to begin.
-
Select a column.
The operators and subsequent operands depend on the data type of the selected column.
-
If a query compares a number column (integer or double) with a string value, no data is fetched, and no changes are made to the datastore and returned values. The exception to this is if the query compares a number column with an empty string. The value "0" is used in place of the empty string.
-
To match a string column with null or empty values, use the most appropriate operator from the following: is null, is not null, is null or empty, is empty, is not empty
-
-
Create complex queries with nodes and groups.
-
Click Preview to ensure the right records are matched.
If the query compares a number column to a variable, Studio displays a warning as the preview action does not have access to variable values. You should check that the variable value is a number. If it is a number, the query will resolve successfully at runtime.
-
-
Order and sort the datastore.
Select up to three columns. The datastore sorts on the first selected column, then the second, then the third.
-
From the Order by menu, select a datastore column.
-
Select the sort order as Ascending or Descending.
-
-
Fetch from the datastore values matched by the query condition.
-
From the Collection Structure, select a JSON name-value pair.
When selected, the path to the name-value pair appears in the JSON Path field.
-
To edit the JSON path, select Editable JSON. For more information, see Editing the JSON Path.
-
From the Assign path to variable field, select a variable to assign to the JSON path.
If the variable has not been created yet, type the name of the variable in the field.
If the datastore column's values are encrypted, select a secure variable to assign to the JSON path.
Studio evaluates any variables in the datastore column's values when assigning a value to the variable in the Assign path to variable field. For example, if the datastore column value is "${{amount}}", Studio assigns to the variable in the Assign path to variable field the value "$100" if 100 is the current value of {{amount}}.
-
In the Default Value (optional) field, assign a default value to the variable.
The default value itself can be a variable. Type two curly brackets {{ and select from the available options.
-
Click Assign.
-
Repeat using another JSON name-value pair from the Collection Structure.
This is complete when each fetched value to use in the call flow is assigned to a variable.
-
Update Action
Update a row in the selected datastore.
-
From the Action menu, select Update.
-
Identify datastore columns to update and update values.
-
From the Allow Update column, select the datastore columns to update.
-
To enter updated values, click the pencil to the right of the Value field.
This opens the Expression Builder.
-
-
Enter the row ID to update.
This can be entered as a variable.
Delete Action
Delete a row from the selected datastore.
-
From the Action menu, select Delete.
-
Enter the row ID to delete.
The row ID can be entered as a variable.
The datastore node cannot be used to delete rows in the system log.