Changing the name of a declared variable

How to change only the name of a variable already declared within a →graphical editor:

  1. Make the list of declared variables visible. Alternative for an →input variable, →output variable or →in-/out variable: Open the interface editor for the object (from within the project explorer).

  2. In this list, select the variable and click onto the name of the variable.
    Alternative: Use the command Edit Name provided within the context menu or press the F2-key.

  3. Enter the requested text.

  4. Accept the change by pressing the Enter-key or clicking the primary mouse button outside of the current field . Press the ESC-key , if you want to discard the change.
    In case of a changed name and if this variable is already used, the corresponding code is refactored:

    • All usages of an internal or external variable in the current object are automatically renamed to the new name.

    • All usages of an input or output variable in the objects (e.g. ST-/FBD-objects) of the current project are automatically renamed to the new name. Subsequently, the command Undo in an ST-object might cause a faulty code (see troubleshooting article "Call in ST-code is suddenly fault, after 'Undo' has been called" for more details).

    Restriction for renaming a global or external variable

    The corresponding counterpart is not automatically renamed.
    This means: When renaming a global variable, the external variable of the same name is not renamed. Likewise when renaming an external variable, the global variable of the same name is not renamed.

But you are able to change the instance name for a set →call of a →function block directly at the set call. See " Showing/hiding and editing the instance names of blocks ".

Good to know

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg logi.CAD 3 provides the additional possibility to change the name, the data type and the initial value of the variable at one go. See "Changing name, data type and initial value of a declared variable" for this possibility.