Allocators

This item is used to make changes to the value of variables. A change to a variable value is called an allocation. An Allocator item can include more than one allocation.

tog_minusSample Use Case

You could create an application that works out the age of a dog in human years, based on input from a user. The Allocator would be used to allocate the age of the dog, using a formula to represent the theory that each year for a dog is the equivalent of 7 human years:

dog_age = 3

human_age = 7 * dog_age

In this example, the Allocator would allocate the value of 21 to human_age (which is the result of the formula calculation). This would be a single allocation.

If required, an Allocator can perform lots of allocations in a single operation. The Allocator represents the entire operation of taking the formula (dog age * 7) and assigning the outcome to a variable (human_age). In this simple example, the user would need to create a variable to hold the dog age, another variable to hold the human age representation, a constant to represent the multiplier in the formula (or simply use the actual value of 7 in the formula), and the formula itself. These items can then all be used to create an Allocator element.

tog_minusDefining Allocators

Creating an Allocator involves selecting options from the dropdown lists of the Allocator Definition dialog:

Left-hand dropdown: Specifies the variable that the allocation will change. You can also create a new variable.

Center dropdown: Enables you to add a value to the variable, set the variable (using equals), or subtract from the variable. The Equals is used to perform a straight allocation. If the variable is some form of counter, the operation may be set to Add (to count up) or Subtract (to count down).

Right-hand dropdown: Enables you to either set a hard coded value for the variable, or to select an existing element that determines the value of the variable.

Allocator Definition Dialog

Other settings are described in the following table:

Setting

Description/Notes

Reference name

The name of the Interaction element. The name should be unique, so it can be used for referencing. The reference name appears only in Design view. It is not visible to users.

Add Allocation

Clicking this button allows you to specify the variables to be changed by the Allocator (each of these is an allocation).

Up/Down/Delete

These buttons enable you to order an allocation (by moving it up or down in the list), or remove an allocation.

Use existing element

When selected, the variable is updated by another item in the application. Select the relevant element from the dropdown list below the checkbox.

When the checkbox is cleared, you can enter a value into the textbox directly (e.g., the value 21).