system.gui.getQuality

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 Tag Quality and Overlays page.

Syntax

system.gui. getQuality( component, propertyName )

  • Parameters

JComponent component - The component whose property is being checked.

String propertyName - The name of the property as a string value.

  • Returns

int - The data quality of the given property as an integer.

  • Scope

Client

Code Examples
Code Snippet
#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 is 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 qualityCode != 192:
#...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 %i \n Please check the device connection")
else:
#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")