system.gui.getQuality
This function is used in Python Scripting.
Description​
Returns the data quality for the property of the given component as an integer. This function can be used to check the quality of a Tag binding on a component in the middle of the script so that alternative actions can be taken in the event of device disconnections.
A description of the quality codes can be found on the Quality Codes and Overlays page.
Client Permission Restrictions​
This scripting function has no Client Permission restrictions.
Syntax​
system.gui.getQuality(component, propertyName)
Parameters​
Type | Parameter | Description |
---|---|---|
JComponent | component | The component whose property is being checked. |
String | propertyName | The name of the property as a string value. |
Returns​
Integer - The data quality of the given property as an integer.
Scope​
Vision Client
Code Examples​
Example #1
# The following code checks the quality code on an component. If a quality is anything other than good, a message appears.
# Fetch the quality code from the Value property on a Numeric Label. The Numeric Label in this example is inside the same container as this script.
qualityCode = system.gui.getQuality(event.source.parent.getComponent('Numeric Label'), "value")
# Evaluate the quality code. If a value other than 192 is returned:
if str(qualityCode) == "Good":
# The quality code is good, so continue working. This example simply shows a message, but could be modified to do something more meaningful
system.gui.messageBox("The property is showing good quality")
else:
# ...then show a message informing the user. Using Python's string formatting (%i) to pass the quality code into the message.
system.gui.messageBox("Operation Aborted \n The associated tag is showing quality code %s \n Please check the device connection" % qualityCode)