List of the declared variables

The tab Variables (below the drawing field of the →graphical editor) contains a list displaying all →variables and →function block instances (= instances) that are declared within the object.

The following illustrations depicts the list for an FBD function block:
images/download/attachments/443058020/FBDVarDecl_EN-version-2-modificationdate-1587466873065-api-v2.png

By default, the tab Variables is not visible for the editor. You can make the area visible by the following possibilities (this is to be done per editor):

  • Click images/download/thumbnails/414778149/FBDHideVarDecl-version-1-modificationdate-1534238178900-api-v2.png (left of the horizontal scroll bar below the drawing field).

  • From the context menu of the drawing field, select Show/Hide and Toggle Variable List.

  • Press Ctrl+L.

If the tab Namespace is in the foreground, change to the tab Variables.

If you want to hide the list (incl. Namespace), repeat one of the above possibilities for making the area visible.

Components of the list of the declared variables

Columns of the list

The following columns are visible within the list:

  • Column Name displays an icon for the variable/instance and the name of the variable/instance.
    The following icons are displayed in the column:

    Icon

    Meaning

    images/download/thumbnails/413893088/Var-version-1-modificationdate-1533812279373-api-v22.jpg

    internal →variable

    images/download/thumbnails/413893093/VarInput-version-1-modificationdate-1533812305462-api-v22.jpg

    →input variable

    images/download/thumbnails/413893098/VarOutput-version-1-modificationdate-1533812324909-api-v22.jpg

    →output variable

    images/download/thumbnails/414778214/VarInOut-version-1-modificationdate-1534239027388-api-v22.png

    →In-out variable

    images/download/thumbnails/413893103/VarExternal-version-1-modificationdate-1533812344791-api-v22.png

    →external variable

    images/download/thumbnails/413893074/VarGlobal-version-1-modificationdate-1533808466516-api-v22.png

    →global variable

    images/download/thumbnails/409862631/Instance-version-1-modificationdate-1531214366502-api-v22.jpg

    instance of a →function block

    images/download/thumbnails/414778154/VarUserDT-version-1-modificationdate-1534238223509-api-v2.png

    variable with →user-defined data type

    images/download/thumbnails/414778159/VarElement-version-1-modificationdate-1534238242521-api-v2.png

    element from user-defined data type
    These elements are displayed, if the variable is expanded .

    images/download/attachments/405733678/IconError-version-1-modificationdate-1529909643654-api-v22.png

    faulty variable
    Possible causes for errors are:

    • The data type does not exist.

    • The initial value does not match the data type. Example: initial value 100 for data type BOOL

    • The variable is declared repeatedly with the same name.

    images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg Usually, it is not possible to cause these errors within the graphical interface of logi.CAD 3 . However, the errors might be caused when the object is automatically created (e.g. during a migration).
    Check the Problems view which message is displayed in order to identify the exact cause. Then correct the reported errors.

    images/download/attachments/406487158/IconWarning-version-1-modificationdate-1530101469876-api-v22.png

    unused variable

  • Column Section informs about the declaration of the variable/instance within the object.
    The following information might be displayed in the column:

    Information

    Declaration as

    L

    internal variable; or the instance of a function block

    I

    input variable

    O

    output variable

    IO

    in-out variable

    G

    global variable

    EXT

    external variable

  • Column Data type provides the →data type of the variable/instance.

  • Only within the FBD-editor : Column Usage informs how a variable is used. A usage is shown for an instance, only if a variable (e.g. an in-/output) of this instance is used within one →value field at least.
    The following information might be displayed in the column:

    Information

    Meaning

    Read

    The variable is used in one value field at least. Only the outputs of the value fields are connected to different FBD-elements.

    Write

    The variable is used in one value field at least. Only the inputs of the value fields are connected to different FBD-elements.

    Write/Read

    The variable is used in one value field at least. The outputs as well as the inputs of the value fields are connected to different FBD-elements.
    The variable might also be used in several value fields -- at least one value field with the usage Read and a different value field with the usage Write.

    Used

    The variable is used in one value field at least. Neither the inputs nor the outputs of the values fields are connected to different FBD-elements.

    Unused

    The variable has been declared but not used in any value fields.
    This variable is also highlighted by the icon images/download/attachments/406487158/IconWarning-version-1-modificationdate-1530101469876-api-v2.png within the column Name.

  • Column Initial value provides the →initial value of the variable/instance.

  • Column Attributes indicates the attributes for the variable/instance. images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg At present, these attributes can only be specified when you are creating a value field with a new variable (by using a corresponding prefix).

    Attribute

    Meaning

    CONSTANT

    The variable is a →constant variable.

    NON_RETAIN

    The variable is a →non-retentive variable.

    RETAIN

    The variable is a →retentive variable.

  • Column Namespace provides the used →namespace.

  • Column Description provides a description of the variable/instance (also known as long name).
    If the variable has been declared based on a →structured data type and a description exists for a structure element, this description is displayed for the subelement of the variable.

  • Column Comment provides a comment of the variable/instance.
    If the variable has been declared based on a →structured data type and a comment exists for a structure element, this comment is displayed for the subelement of the variable.

If you do not need some items of information, you can hide the appropriate column:

  1. Click images/download/thumbnails/414778166/FBDVarDeclHideColumns-version-1-modificationdate-1534238365269-api-v2.png (right of the columns) and select the appropriate column in the list (Checked columns are visible. Unchecked columns are hidden.)

  2. If you require the items of information again, click images/download/thumbnails/414778166/FBDVarDeclHideColumns-version-1-modificationdate-1534238365269-api-v2.png again and select the appropriate column in the list.

It is possible to change the order of the columns as follows:

Point to the header of the column that you want to move. Then press and hold the primary mouse button, drag the column before or after a different column and release the primary mouse button.

Toolbar

The list provides a toolbar with buttons and an input field to filter the list content.

Creating new variables

See " Declaring variables " and " Declaring a Boolean local variable fast ".

Dragging variables/instances from list into the drawing field

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg This action is only provided within the FBD-editor .

If you drag variables/instances from the list into the drawing field, the appropriate FBD-elements are created in the drawing field. Details: see "Creating value fields and function block instances by dragging elements from the list of declared variables".

Deleting variables/instances

See "Bereits deklarierte Variablen löschen".

Finding the usages of a variable/instance

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg This action is only provided within the FBD-editor .

See "Finding references (= usages) for an element".

Toggling the fully qualified name of the type

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg This action is only applied within the FBD-editor .

See "Using the list of the used namespaces".

Sorting variables/instance in the list

Variables/instances can be sorted by a column in ascending or descending order:

  1. Click the column header that you want the sorting to be based on.
    Result: images/download/thumbnails/414778171/FBDVarDeclDownArrow-version-1-modificationdate-1534238387636-api-v2.png in the column header indicates the descending order, images/download/thumbnails/414778176/FBDVarDeclUpArrow-version-1-modificationdate-1534238406512-api-v2.png indicates the ascending order.

  2. If you need to activate the other order type: Click on the column header again.

Filtering list content

By default, the list shows all variables/instances declared in the object.

How to filter the list to view only variables containing a particular text in columns Name or Data type:

  • Click into the input field above the columns and enter a filter text.
    Result: A full text search is performed. The view lists only elements that are matching the filter text. The hierarchical view is adjusted: Levels without matches are hidden.

How to filter the list to view only variables with a particular declaration and/or instances:

  1. Click one of the icons in toolbar above the columns.
    Result: Only the variables of this declaration section or only the instances are displayed. The icon is displayed as being pushed.

    Icon

    images/download/thumbnails/414778181/FBDVarFilterL-version-1-modificationdate-1534238427911-api-v2.png

    images/download/thumbnails/414778186/FBDVarFilterI-version-1-modificationdate-1534238449844-api-v2.png

    images/download/thumbnails/414778191/FBDVarFilterO-version-1-modificationdate-1534238470333-api-v2.png

    images/download/thumbnails/414778196/FBDVarFilterIO-version-1-modificationdate-1534238489278-api-v2.png

    images/download/thumbnails/414778201/FBDVarFilterE-version-1-modificationdate-1534238509532-api-v2.png

    images/download/thumbnails/414778206/FBDVarFilterG-version-1-modificationdate-1534238531970-api-v2.png

    images/download/thumbnails/443057969/FBDVarFilterFB-version-1-modificationdate-1587396913295-api-v2.png

    Meaning

    internal variable

    input variable

    output variable

    in-out variable

    external variable

    global variable
    (only provided within a program)

    function block instance

  2. Click a different icon in order to only display the variables of this declaration section or the instances.

  3. Click images/download/thumbnails/443057972/FBDVarFilterIcon-version-1-modificationdate-1587396916759-api-v2.png and clear the settings within the dialog in order to hide the variables of these declaration sections and/or instances.

How to view all variable and instances again:

  1. Click into the input field above the columns and delete the filter text previously entered.

  2. Click images/download/thumbnails/443057972/FBDVarFilterIcon-version-1-modificationdate-1587396916759-api-v2.png and select all settings within the dialog. Alternative outside of the filter dialog: If only one icon is displayed as being pushed: Click this icon within the toolbar.

Good to know

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg If you create a new variable within the list of the declared variables, all variables of this declaration section are automatically displayed – even if these variables have been hidden before the creation.

Selecting variables/instances in the list

  1. Select the first variable/instance by clicking onto it.

  2. Press and hold the Ctrl-key or the Shift-key.

  3. Select the next variable/instance by clicking onto it.
    Result: If you have held the Ctrl-key, both variables/instances are selected. If you have held the Shift-key, all variables/instances in between are selected as well.

  4. Repeat the last step until all requested variables/instances are selected.

How to select all variables/instances in the list: Press Ctrl+A.

Expand/collapse variables/instances

Variables with subelements as well as instances are showing the icon images/download/thumbnails/447611422/Collapsed-version-1-modificationdate-1592222555334-api-v2.png in front of their name. By default, the subelements of variables and instances are not shown.

Use one of the following possibilities to show the subelements:

  • Click on icon images/download/thumbnails/447611422/Collapsed-version-1-modificationdate-1592222555334-api-v2.png of a variable or an instance.

  • Select one or several variables/instances, open the context menu and select the command Expand All.

  • Select one or several variables/instances and press one of the following keyboard shortcuts:

    • → ( cursor movement key "Right")

    • + ( plus character ) on the keyboard or numeric keypad

    • * ( multiplier character ) on the keyboard or numeric keypad

Use one of the following possibilities to hide the subelements:

  • Click on icon images/download/thumbnails/447611429/Expanded-version-1-modificationdate-1592222598644-api-v2.png of a variable or an instance.

  • Select one or several variables/instances, open the context menu and select the command Collapse All.

  • Select one or several variables/instances and press one of the following keyboard shortcuts:

    • ← ( cursor movement key "Left")

    • – ( minus character ) on the keyboard or numeric keypad