Is there a way to search for a tag name through an expression or a script that can drop a true or false if it exist or it doesn’t
You can use system.tag.exists()
(from memory)
I’m trying like this with a existing tag but didn’t work
if system.tag.exists("FE-301_Flow"):
from java.awt import Color
event.source.fillPaint = Color(187,187,187)
else:
from java.awt import Color
event.source.fillPaint = Color(187,0,255)
and this shows an error at the line: if system.tag.exists(“FE-301_Flow”)***(from memory):***
(from memory)
then I read that we have to add the provider name but nothing happen
if system.tag.exists("[default]FE-301_Flow"):
Is that the full tag path to the tag? Are you not using a folder structure?
Also, the system library comes from the scripting framework, it looks like you’re trying to use this in an expression? I think you’re mixing up the expression language with the scripting language (jython), as you’re also using colons which are again a jython thing.
In expressions, you could read the quality of the tag and check if it’s “Not Found”. You’ll need to cast the quality to a string to compare it.
toStr({tag.quality}) = "Not Found"
Look at the last post in this thread,
Also I did try the other way through an expression with a label that changes the text base on
if the tag exist or it doesn’t, but the answer of it says it always exist
if (toStr({[default]nonexist.Quality}) = "Not Found","Do not exist","Does exist")
well guys I found this it was just a little error on what we where looking for “not found”
the text that it drops its Bad_NotFound
and this works perfect!
tag = B5/TESTING/A_Value
if (toStr({B5/TESTING/A_Value.Quality}) = "Bad_NotFound","Do not exist","Does exist")
Thanks for help to everyone