Disabling a Tag

I have created a UDT and have imported 150 tags. I have linked the tags to objects like display etc.
I would like to know, if there is any in which I could selectively disable a tag, during run time.
In other words, when i click the display for a particular tag, a popup opens with a button to disable that particular tag, (I have created the pop-up). I was unable to access the ‘enabled’ option for the tag in question. Is there any way to disable the tag during ‘run-time’?

Hi,

I believe it should be possible to write to the tag’s enabled property through the [tt]system.tag.write[/tt] scripting function, but I’m curious- what are you trying to accomplish? Is the tag some sort of expression tag that is doing something that you want to stop? I only ask because doing this hasn’t been requested much, so perhaps there’s a different way to accomplish what you want.

At any rate, you’ll need the path to the tag. If you have that, or can derive it off of the path meta property on the udt, you could do something like this:

system.tag.write('Path/to/Tag.Enabled', 0)

and 1 for enabled again.

Regards,

Also, I moved this away from Knowledge base to Design Help, because that’s the best place for it. Knowledge Base is, theoretically, stuff that we post. Anyhow, no big deal, thanks for posting and welcome to the forum!

Thanks for the reply!
I tried

system.tag.write('Path/To/tag.Enabled',0)

I got an error, so I tried

system.tag.writeToTag('Path/To/tag.Enabled',0)

I didn’t get an error this time.
However, I couldn’t disable the Tag. :neutral_face:
I have seen that this particular property’ Enabled’ is in the general properties of the tag, (with the name, data type, read/write options etc).
Also, When I open the script editor for event handling, I can access the tag path through the tag symbol on the right hand side. Under the tag I could find properties such as quality, alarm, etc.
BUT I couldn’t find any property called ‘ENABLED’
The reason for disabling the tag is because, I am connected to many devices and if I am not interested in any one particular device, I would like to disable the tag linked to that device. and I would like to see that the device has been disabled on the screen.
Looking forward to a solution

Hi,

I’m not sure why you got an error with write(), as that seems to work fine for me. However, that’s irrelevant, because you’re right that it’s not actually disabling the tag. Unfortunately, it looks like writes to certain properties (Enabled, DataType, Scanclass, AccessRights) aren’t being stored/applied correctly. This is something we’ll have to fix on our side.

At any rate, I think it would be better to go a different route. Here’s what I would do.

  1. Make a boolean tag (memory tag) for each device indicating whether or not it’s enabled. So, something like “Device1_Enabled”.
  2. Make a scan class for each device. Use the following settings:
    o Mode: Driven
    o Slow Rate: 0
    o Fast Rate: Whatever you want
    o Driving Tag: Device1_Enabled
    o Operator/Value: != 0
  3. Set all of the tags from that device to use that scan class.

If you want to have multiple scan rates, that’s fine too, just make multiple driven scan classes, all driven by the same tag, with different fast rates.

With this setup, to control whether or not the device is enabled, you simply have to write to the control tag. The only down side is that when the device is disabled, you won’t get overlays, because the quality won’t change- however, you can create your own visual indicator (a banner across the top, bind the components’ enabled to the control tag, etc) using the control tag value.

The end result is more or less the same, and I think it’s much more efficient and much less error prone that trying to write to each tag in the device.

Regards,

I have 150 tags that were derived from a User defined datatype. These tag correspond to modbus registers. So I’ll have to do this 150 times. (Each device corresponds to 1 tag). This would be very tedious and labor intensive.

Isn’t there any other way to do it. Could we deliberately change the quality of tag to make it look like a disabled tag ?

Looking forward to your reply…

Hi,

I’m not sure I understand- you have 150 tags, each one representing a device. Are these the tags you want to disable? Or, do you mean that you have 150 UDT instances, each of which has many tags, and you want to disable that UDT instance, in turn disabling all of the tags on that device?

If that last sentence is correct, then you might be right that writing to the tag is easier. Setting up 150 scan classes might be less efficient (there are probably ways that could make it not so bad with csv export/import, but still).

At any rate, we’ve fixed it so that in 7.5.5, writing to enabled will work.

Regards,

I have 150 UDT instances, each of which has many tags, and I want to disable that UDT instance, in turn disabling all of the tags on that device.
Is the Demo version 7.5.5 version available for download?
I look forward to using it.

Hi,

Ok, that’s what I thought, so yes… disabling the UDT instance seems like a good way to go. There is a beta up right now (beta 5), but what you need won’t be in that. We’re freezing 7.5.5 today, so the final update should be out next week some time, probably tues or so, if all the tests go well.

Regards,

Hi
I was trying to disable some tags through the above-mentioned script

and I was able to disable the entire UDT but have a question regarding the performance behind disabling the tags. Let's say I have 300 tags out of which I'll be using only 20-30 for a particular device 'A', if I disable the rest for the other devices, does it improve my performance since the tag drivers don't have to monitor 250+ tags now or is it indifferent? TIA

Sam