<< Click to Display Table of Contents >> Change values of 2 tags by one click |
|
In this example, we'll show you how to change the values of two tags with one click. Suppose we have two containers with liquid that needs to be heated to either 50°C or 70°C. By pressing one button we will set the temperature in both containers - 50°C, and by pressing the other - 70°C.
Let's create two tags - Tag2 and Tag3. We will change the values of these tags simultaneously by pressing the buttons. These buttons will toggle the intermediate tags - write50 and write70.
1. Let's create Tags:
2. Create buttons and bind write50 and write70 tags to two buttons:
3. Now let's create 2 scripts that will be called when the values of these two tags are switched from FALSE to TRUE:
After you have recorded the script, be sure to launch it by clicking the button on the toolbar:
4. And let's bind these 2 scripts to tags - write50 and write70:
Now when tags write50 and write70 switch from FALSE to TRUE, the corresponding script is called.
5. Run simulation to check the settings:
You can download this project here.