I should have asked for this a
very
long time ago to be honest...
I would like a function to check if a tag is valid. What I mean by this, is that it both exists and is not disabled. No other qualities should affect the value returned.
Often I will create templates / view templates that can accommodate multiple UDT definitions and/or instance configurations. E.g. differences in the tags available between UDT defs or tags that are disabled in particular instances of the UDTs. To accommodate these, I will check the quality of tags and hide the graphic component if the associated tag isn't valid.
For these cases, currently I'm simply using
isGood()
, but technically this can be deceptive. If a tag is in fact valid for a UDT but has a configuration error for example, or is stale, waiting for initial value, etc. etc. then the graphic component using isGood will hide the display for it and essentially mask the issue, and will confuse the operator who is expecting to see the thing that is hidden.
The alternative currently is incredibly dopey and long-winded. I would have to do something like:
indexOf(toStr(qualityOf({tag})), 'Bad_NotFound') = -1 &&
indexOf(toStr(qualityOf({tag})), 'Bad_Disabled') = -1
I would like a new function explicitly for testing this, like
isValid
or
existsAndEnabled
or similar so that I can just use:
isValid({tag})
or
existsAndEnabled({tag})