Support Forums
Diable control based on tag value

Is there a method to disable a control based on the value of a tag?
For example if i have a control set to "REMOTE" instead of "LOCAL" i want it to disable all the local controls based on this status tag.

Is there a method to disable a control based on the value of a tag? For example if i have a control set to "REMOTE" instead of "LOCAL" i want it to disable all the local controls based on this status tag.

You can head to the security setting and add a custom privilege named WriteLocked. Where you add this, click the box to show privilege numbers (your's will probably be 16). Then in your I/O tags I/O tab, you will see a privilege dropdown. You should see your custom privilege is available here.

Right-click on the dropdown and select add a parameter expression. Your expression should look something like the following, which will lock tag writes if [PathToControlTag] = 1:

PickValid([PathToControlTag],0) == 1
? invalid
: 16

Before you click ok on the expression, deselect the 'optimize to only evaluate at...' box, so this will be continuously monitored rather than only checked when the app is launched.

The PickValid() function is there to ensure that your conditional statement resolves such that you can write values if, for some reason, your control tag is invalid.

Note that a change in the control tag will cause the tags with the custom expression to restart, so if you plan to do this on thousands of tags, you will see a performance hit. Note that if you don't want to add this expression everywhere, you can also link your expression to the result of a calc tag and place the code above in the calc tag.

I'm sure you'll have more questions but remember you can read up on things like PickValid() by pressing F1 in VTScada to launch the help files.

Good luck, and let us know how this works out for you. I tested it locally, and it worked well for me. smile

You can head to the security setting and add a custom privilege named WriteLocked. Where you add this, click the box to show privilege numbers (your's will probably be 16). Then in your I/O tags I/O tab, you will see a privilege dropdown. You should see your custom privilege is available here. Right-click on the dropdown and select add a parameter expression. Your expression should look something like the following, which will lock tag writes if [PathToControlTag] = 1: ```` PickValid([PathToControlTag],0) == 1 ? invalid : 16 ```` Before you click ok on the expression, deselect the 'optimize to only evaluate at...' box, so this will be continuously monitored rather than only checked when the app is launched. The PickValid() function is there to ensure that your conditional statement resolves such that you can write values if, for some reason, your control tag is invalid. Note that a change in the control tag will cause the tags with the custom expression to restart, so if you plan to do this on thousands of tags, you will see a performance hit. Note that if you don't want to add this expression everywhere, you can also link your expression to the result of a calc tag and place the code above in the calc tag. I'm sure you'll have more questions but remember you can read up on things like PickValid() by pressing F1 in VTScada to launch the help files. Good luck, and let us know how this works out for you. I tested it locally, and it worked well for me. :)

Trihedral Engineering Ltd.

edited Oct 21 '22 at 2:10 pm
49
1
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft