system.tag.read
This function is used in Python Scripting.
Description
Reads the value of the tag at the given tag path. Returns a qualified value object. You can read the value, quality, and timestamp from this object. If the tag path does not specify a tag property, then the Value property is assumed.
You can also read the value of tag attributes by appending the attribute to the tagPath parameter. See the Tag Properties page for a list of available attributes.
Client Permission Restrictions
This scripting function has no Client Permission restrictions.
Syntax
system.tag.read(tagPath)
- Parameters
- String
tagPath
- Reads from the given tag path. If no property is specified in the path, the Value property is assumed.
- String
- Returns
- QualifiedValue - A qualified value. This object has three sub-members: value, quality, and timestamp.
- Scope
- All
Code Examples
Example #1
# This example would read a value and display it in a message box.
qv = system.tag.read("[default]EastSection/ValveG/HOA_bit")
system.gui.messageBox("The value is %d" % qv.value)
Example #2
# This example would check the quality of a tag value, and write it to the database if the quality is good
qv = system.tag.read("[default]EastSection/ValveG/HOA_bit")
if qv.quality.isGood():
system.db.runPrepQuery("INSERT INTO VALVE_TABLE (HOA) VALUES (?)", [qv.value])
Example #3
# This example would check the value of the EngHigh attribute on the tag
qv = system.tag.read("[default]EastSection/ValveG/HOA_bit.EngHigh")
system.gui.messageBox("The EngHigh value is %d" % qv.value)