Allocators are used to automatically assign a known value to a variable, or to assign the value of one variable to another variable.

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

  • Make navigation easier for the user. If the same variable is used multiple times in a Flow, once a value is allocated to it, that value is automatically used in all instances where the value is required (e.g., a customer phone number). The customer does not have to re-enter it. (If the value of the variable is updated during the Flow, the latest value is allocated.) 
  • 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 is then used by a Decision step that determines the direction of 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.

Creating 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. Allocators are defined and maintained in the Allocator Editor.

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 web 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 enable 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 example, for text, date, currency, and number data types, 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.
Source Value (Right Side) Provide a hard coded value to allocate to the target variable, or select an existing element 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 Create a new variable (refer to Creating User Variables)
  • Enter a hard coded value
The Add icon for creating additional allocations. When you create several allocations, you can reorder them using drag-and-drop. Allocations are performed in the order that is specified from top to bottom.

 

To create an Allocator:

  1. From the Flow map, hover over the relevant page and select Navigation Logic>Allocator. The Allocator Editor opens.
  2. In the Allocation Name field, enter a unique name for the allocator.
  3. Click in the left side (target) variable field, and either:
    • Select the variable from the list of all inputs and variables, or
    • Click  to add a new variable.
      (For instructions, refer to Creating User Variables.)



  4. Select the desired allocation operation (Refer to the table above for details.)
  5. 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



  6. Click  to add more allocations, as required.
  7. When you are finished, click Create Allocator
    The allocator appears on the Flow map, and is connected to the page from which it was created.

 

Revision:

Comments