Renaming a Variable in XG5000
XG5000 has a couple of ways to change a variable name in the variable declaration and program code.
-
Just renaming a variable in the declaration will not change the name in programs and tasks. This may lead to program check errors.
- Variables can be renamed either by using Rename Symbol in the Refactoring menu, or by using Replace String through the Find/Replace menu.
Rename symbol will change the variable name in all locations of the XG5000 project.
-
Local variables are only changed in the Scan program or task they are declared and used in.
-
Global Variables are changed in all locations it is used.
Step | Action |
---|---|
1 |
Open Local Variable file or Global/Direct Variable file. This example shows the Local Variable file.
|
2 | Right-click on the variable to be renamed. Select Refactoringè Rename Symbol… |
3 |
Type the new variable name in the text box.
|
4 | Press the Rename button to rename the variable in all locations. Press Cancel to cancel the operation. |
5 |
Press Yes to complete the operation. Press No to cancel.
|
The Replace String function can be used to change the name of a variable in selected locations.
Step | Action |
---|---|
1 |
Open Local Variable file or Global/Direct Variable file. This example shows the Global/Direct Variable file.
|
2 |
Right-click on the variable to be renamed. Select Copy to store the variable name to rename.
|
3 | Open Find/Replace menu and select Replace String… |
4 |
Select Multiple windows in the Look in section. Press the … button next to the Multiple windows option.
|
5 |
Put a check mark in the locations where the name should be changed. Press OK to exit this window.
|
6 |
Enter the new variable name.
|
7 |
Press Replace All button to change the name in the selected locations.
|
LP111