Skip to main content

Uniphore Customer Portal

Allocating Values to Variables

You can create an Allocator to assign a known or calculated value to a variable, or to assign the value of one variable to another variable, during a Flow.

Allocators are commonly used to manipulate real-time data and help streamline the Flow. For example, Allocators let you:

  • Make a global change to a variable. When you change the allocation source value, the new value is applied to all instances of the target variable.

  • Hold data to be used by other Flow elements. For example, the answer to an input question can be allocated to a variable. That variable can then be used by a Decision Point element to direct the Flow according to the value of the variable.

  • Transfer variables between two Collections. Easily move variables from a specified source Collection to a target Collection, replace or clear a specific variable.

About Allocators

An Allocator must have a unique name, a target variable, and a source value (or variable) that will be allocated to the target variable. You define and maintain Allocators in the Allocator Editor.

allocator-variables-completed_annotated_280120.png

The following table describes the Allocator Editor settings:

Setting

Description/Notes

Allocator Name

Enter a unique name for the Allocator element. Allocators are only visible in the X-Designer and are transparent to end-users.

Target Variable (Left Side)

Determine the variable that is affected by the allocation. Select an existing variable from the popup list of all variables, or create a new variable for this purpose. Any variable can be used, including a Dynamic Variable member path, an item from a Collection, or a field from a Custom Type.

Operation

Determine the behavior of the allocated value:

  • Equals - Replaces the target variable value with the one you set in the Allocator. Boolean data types will provide this operation only.

    When working with a Collection, Equals enables you to override the values of all variables in the target Collection (left side) with the values in the source Collection (right side), or assign a specific target variable with either a constant value or the source variable value at a specified position in the Collection using the .elementAt variable.

    When working with a Dynamic Variable, Equals enables you to override the entire value of the target Dynamic Variable (left side) with the JSON code provided by the source value (right side), or assign a specified target Dynamic Variable member path with either a constant value or the source variable value specified, including another Dynamic Variable member path. Note that if the member path specified for the target (left side) does not exist, it will be created and added inside the target variable.

  • Add - Adds the value to the values for the target variable.

    For date variables, you can automatically add a set number of days to a purchase date to determine a specific delivery date.

    When working with a Collection, Add enables you to add the specified source value (right side) at the end of the target Collection (left side).

  • Add All - (Collection Only) Appends the value or values from the source (right side) at the end of the target Collection (left side).

  • Subtract - Subtracts the value from the values for the variable. This option is available for date, currency, and number data types. For example, the Allocator may automatically subtract a set amount from the product purchase price.

  • Clear - (Collection Only) Clears all values from the specified target (left side).

  • Remove At - (Collection Only) Deletes the value specified by .elementAt in the source Collection (right side) from the target Collection list (left side). The next value (and all subsequent values) in the target Collection are relocated to take the place of the value that was removed.

  • Remove - (Dynamic Variable Only) Deletes the value of the target Dynamic Variable member path specified (left side). When this is used, the right side entry is not displayed.

  • Restore Default Value - Resets the specified target variable to its Default Value (assigned in the variable editor). When this is used, the right side entry is not displayed.

Source Value (Right Side)

Provide a hard-coded value to allocate to the target variable, or select an existing variable that determines the value allocated to the target variable. Any variable can be used, including a Dynamic Variable member path, an item from a Collection, or a field from a Custom Type.

Make sure that the value you define here is of the same type (text, number, etc.) as the target value. The variable or value you enter will be used for all instances of the target variable in this Flow.

When assigning value(s) to a target Dynamic Variable (left side), provide valid JSON code or a static value for the target variable member specified. The Allocator does not perform a type check when a Dynamic Variable is assigned. Invalid code or non-matching types will not return any response.

Use one of the following options:

  • Enter '@' and then Select an existing variable from the Variables list

  • Enter '@' and then + to create a new variable

  • Enter a hard-coded value

Creating an Allocator
  1. At the top left of the Flow Map, click the round Add Steps icon. The Add Steps Toolbox opens.

  2. From the Logic Elements group, select and drag the Allocator element to the desired location on the Flow Map. The Allocator Editor opens.

  3. In the Allocation Name field, enter a unique name for the Allocator.

  4. Click in the left side (target) variable field, and either:

    • Select the variable from the list of all inputs and variables, or

    • Click the Plus plus-yellow_icon.png icon to add a new variable. (For instructions, refer to Creating User Variables.)

    allocator-variables-left_280120.png
  5. Select the desired allocation operation (Refer to the table above for details.)

  6. From the right side (source) variable field, determine the value to allocate:

    • Enter '@' and then select or add a variable from the Variable list, or

    • Enter a set value

  7. To add more allocation rows, click the Plus plus-yellow_icon.png icon below the last row, as required.

  8. When you are finished, click Create. The Allocator is saved and displayed on the Flow Map.