# Variables by Workato

Workato variable is a user-declared datapill that contains a data value. These user-declared variables are different from a standard datapill in that your declared variables are mutable - the value of the variable can be changed within a recipe.

The lifetime of a variable is for the duration of a single job (job scope) - there is no persistence, and no mechanism can access this across different jobs.

Workato variables are typed. In order to use variables, you will first have to declare it using the create variable action. To update the variable, use update variable action.

# Example

If you want to find a particular entry within a report - the entry with the largest ARR.

  1. Create a variable called ARR.
  2. Run the for each action, and update ARR whenever it finds a higher value.
  3. Subsequently, use the ARR value to call up that specific entry.

Iterate through the report for highest ARR Iterate through the report for highest ARR

# Connection setup

No connection setup is required. Simply select App > Variables by Workato to get started.

Variables by Workato Variables by Workato

# Create variable

This action creates variable(s) in the specified data type. You should configure each variable to match the data type that it will be used for (e.g. integer, string).

Create variable Create variable dialog Create variable dialog box

Multiple variables can be created in this step by clicking on Add variable Create multiple variables Creating multiple variables

Input field Description
Label The name of the variable.
Data type The data type of the variable.
Default value The default value of the variable. Leave this blank to set the default value as nil.

# Update variable

This action updates an existing variable. You can only update variables previously created with the Create variable action. Otherwise, this action cannot be used.

Update variable Update variable

Input field Description
Variable name Select the variable to update.
Value The new value of the variable.

Note

This action does not generate a datapill. To use this variable in another action, use the variable datapill in the Create variable step.

# Reset the value of a variable

You can set a nil value to variables in Update variable action to remove an existing value of a variable. This has to be done in the formula mode.

# Create list

This action creates an empty list with its item schema. The list item schema will apply to every item in the list.

Create list Create list

Input field Description
List name The name of the list.
List item schema Define the properties of each item on this list.

# Define list item schema

The list item schema will show up as a list of usable variables in the output datatree. These variables can be mapped unto subsequent recipe steps. Use Add field to define a new field.

Add new field Add new field

Input field Description
Name The name of the new field.
Data type The data type of the new field.
Optional Select if this new field is mandatory.
Hint A description of this new field.

# Add item to list

This action appends a new item entry to an existing list. You can only update lists created with Variables by Workato.

Some item fields are mandatory. Check that you have valid inputs for the required fields before using this action.

Add item to list Add item to list

Input field Description
List name Select the list to add your new entry.
Insert location Select the location of the new entry.
List item Define the values of the new entry.

Note

This action does not generate a datapill. To use this list in another action, use the datapills in the Create list step.

For more information on list management, see here.

# Clear all items from list

This action removes all entries in an existing list. This action should be used after the Create list and Add items to list action. You can only clear lists created with Variables by Workato.

Input field Description
List name Select the list to clear all entries from.