Overview
To replace variables assigned to elementary functions (EF) or to function blocks (EFB, DFB) in FBD/LD sections use the
dialog box.To find and replace variables connected to functions and/or function blocks you can use placeholders.
Structure elements of multi-element variables (DDTs) cannot be replaced.
If the original variable does not exist, the replacement variable is not possible.
Dialog Box
You have the following options to display the
dialog box:Select the
menu command.Select the
command in the context menu (right-click on one or more EF/EFBs in the section).
Dialog box for replacing functions/function blocks using placeholders

Find and Replace Pattern
The find and replace patterns are applied to all variables connected to the selected functions/function blocks.
The following placeholders can be used:
to search/replace any string
to search/replace any character
Rules for find and replace patterns see below.
Replace Variables
All variables matching
will be listed in a dialog box:
Elements of the dialog box
Element |
Description |
---|---|
|
displays the names of the found variables The entries in this column are not editable. |
|
displays the strings that will replace the names of the found variables The entries in this column are editable. |
|
displays the type of the original variable (not that on of the replacement variable, which could already exist and be of another type) The entries in this column are not editable. |
|
provides the option to enable/disable the variable replacement via a check box By default is enabled for all rows.The entries in this column are editable. |
|
If this check box is selected, the replacement variables will be created in the Data Editor automatically. If such a replacement variable already exists in the Data Editor, the creation will be skipped. Note: If the replacement variable already exists, but has another type than the original one, since creation is skipped the replacement variable may or may not match the type of the connected pin afterwards. Note: If the check box is not selected, no variable creation will take place (some of the replacement variables may be undeclared afterwards). |
Undo/Redo
supports Undo/Redo, which means that the original state will be recreated on Undo (of course without deleting the newly created replacement variables from Data Editor) and the state after replacement on Redo.
Online Mode
is supported in online mode.
Rules for Find and Replace Patterns
Rules for find and replace patterns:
? can be used many times in pattern
* can be used at maximum 2 times in pattern
* can be first and last character in pattern only
no * only and no ** can be used
no ?* and no *? can be used (always another letter between them)
numbers of * and ? in both (find and replace) pattern must be equal
if two * and at least one ? are used the find and replace pattern must be structural identical (same length, same order of normal letters and placeholders)
Examples
Examples of simple replacements
Find Pattern: |
Found Variable |
Replace With: |
Variable is Replaced With |
---|---|---|---|
abc123jmk |
abc123jmk |
abc223jmk |
abc223jmk |
abc123jmk |
abc123jmk |
abc124123jmk |
abc124123jmk |
Examples for replacements with constant characters
Find Pattern: |
Found Variable |
Replace With: |
Variable is Replaced With |
---|---|---|---|
ab?1????k |
abc123jmk |
ab?2????k |
abc223jmk |
abc???12??mk |
abc124123jmk |
abc???022?4?mk |
abc12402234jmk |
Examples for replacements with constant series of characters
Find Pattern: |
Found Variable |
Replace With: |
Variable is Replaced With |
---|---|---|---|
*123jmk |
abc123jmk |
*223jmk |
abc223jmk |
*123* |
abc123jmk |
*223* |
abc223jmk |
*123* |
abc123jmk |
*2234* |
abc2234jmk |
Examples of complex replacements
Find Pattern: |
Found Variable |
Replace With: |
Variable is Replaced With |
---|---|---|---|
abc???12??m* |
abc124123jmk |
abc???022?4?m* |
abc12402234jmk |
*1???mk |
abc123jmk |
*2???mk |
abc223jmk |
*2??jmk |
abc223jmk |
*1240?2?4jmk |
abc12402234jmk |
*1?3* |
abc123jmk |
*2?3* |
abc223jmk |
Examples of array replacements
Find Pattern: |
Found Variable |
Replace With: |
Variable is Replaced With |
---|---|---|---|
array[5* |
array[5] |
array[6* |
array[6] |
array5[5* |
array5[5] |
array5[6* |
array5[6] |
*5* |
array5[5] |
*6* |
array6[5] |
array5[i* |
array5[i5] |
array5[i6* |
array5[i65] |
*5* |
array5[i5] |
*6* |
array6[i6] |
Not Possible
The following complex replacements are not possible
Entry in text field search pattern |
Found variable |
Entry in text field Replace With |
---|---|---|
*1?3* |
abc123jmk |
*2?34* |
*1?3* |
abc123jmk |
*02?34* |
*1241?3* |
abc124123jmk |
*12402?34* |
*12?1?3* |
abc124123jmk |
*12?02?34* |