Creating Global or Local Variables

You can create variables at the resource level or inside a task.

This task shows you how to:


Before you begin: To perform this procedure, you must have an organizational resource containing a robot, a tool device, or a human.

Create a Global Variable

You can associate variables to a resource.

  1. Select a resource and open the Sequencing tab.
  2. From the commands at the bottom of the panel, click Create a Global Var .
    The Global Variable dialog box appears.

  3. Provide the parameters to create a variable of the integer type.

    If Array field is empty, it is a simple variable, otherwise it is an array.

    This gives the capability to model arrays in a Behavior modeler and access dynamically to data members using evaluated indexes.

    Var Array [3];

    Array[index] := Array[index-1] + 1;

    If (Array[index] == 6) ….

    Array definition format:

    [ <d1>, <d2>, <d3>, <d4>] (indexing={<d1b>,<d2b>, <d3b>, <d4b>})

    Where:

    • <di>: is the size of a degree. The maximum number of degrees is limited to 4.
    • <dib>: is the 0/1 based indexing. Indexing declaration is optional, and default indexing is 1.

    If indexing is declared, declaration must be done for every degree.

    Example:

    [10]: Array with 1 degree and 10 items. Indexes between 1 and 10.

    [2,3]:

    • Array with 2 degrees and 6 items.
    • Indexes for 1st degree between 1 and; 2.
    • Indexes for 2nd degree between 1 and; 3.

    [2,3] (indexing={0,1}):

    • Array with 2 degrees and 6 items.
    • Indexes for 1st degree between 0 and; 1 (0 based).
    • Indexes for 2nd degree between 1 and; 3 (1 based).

    Default value format:

    When a variable is declared as an array, it is possible to give a default value.

    The format is similar to C++, using closing and; opening braces.

    Example:

    [10]: {1,2,3,4,5,6,7,8,9,10}

    [2,3] or [2,3] (indexing={0,1}): {{“A”,”B”,”C”},{“D”,”E”,”F”}}

  4. Expand the content of Resource Entities and select the Var tab.

    The new variable is listed as a resource entity.

Create a Local Variable

You can create a variable as a task parameter.

  1. Select a task.
  2. Right-click the task and select Edit.
    The Sequencing Editor appears. At the bottom of the Usable frame, the commands to create local entities are available.
  3. Click Create Var .
    The Variable dialog box appears.
  4. Provide the parameters to create a variable of the Boolean type, and click OK.
  5. In the Usable frame, expand the content of the Variables row.

    The new variable is now available to be used in the Sequencing Editor.

    Tip: If a variable has been defined at the resource level, it appears in the list prefixed by the resource icon.