The ValueQuery object contains the following methods:
The CancelValueFiltering method terminates execution of the query thread, and waits for the specified number of seconds.
CancelValueFiltering(TimeToWaitInSeconds As Integer) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
TimeToWaitInSeconds |
Yes |
The number of seconds to wait for the value query to terminate. This value must be within the range [1 - 100]. |
This method will hang for the specified number of seconds while the query thread terminates. If the query thread has not terminated by the time the interval has expired, this method will return false and the query thread will continue to attempt to terminate in the background. Call this method as part of the cleanup routine after querying is finished.
Example
The following example goes through the entire process of creating a filter, starting the query, retrieving a current value entry from a point tag, and cleaning up the query.
|
Sub
Dim bCreatedOk bCreatedOk = ValueQuery.CreateValueFilter()
Dim bRunning bRunning = ValueQuery.IsValueFilterRunning()
Dim bStarted bStarted = ValueQuery.StartValueFiltering()
' retrieve the current value from a point tag (note that this ' query is designed to work with other queries that return lists ' of point tags, such as PointFacQuery) Dim bRetrieved, pvValueInfoXml bRetrieved = ValueQuery.GetValueEntryAsXml("CYGDEMO.UIS.00002109:MYPOINTTAG", pvValueInfoXml) MsgBox pvValueInfoXml
ValueQuery.CancelValueFiltering(100) End Sub |
The CreateValueFilter method creates a new value query thread.
CreateValueFilter() As Boolean
Example
The following example goes through the entire process of creating a filter, starting the query, retrieving a current value entry from a point tag, and cleaning up the query.
|
Sub
Dim bCreatedOk bCreatedOk = ValueQuery.CreateValueFilter()
Dim bRunning bRunning = ValueQuery.IsValueFilterRunning()
Dim bStarted bStarted = ValueQuery.StartValueFiltering()
' retrieve the current value from a point tag (note that this ' query is designed to work with other queries that return lists ' of point tags, such as PointFacQuery) Dim bRetrieved, pvValueInfoXml bRetrieved = ValueQuery.GetValueEntryAsXml("CYGDEMO.UIS.00002109:MYPOINTTAG", pvValueInfoXml) MsgBox pvValueInfoXml
ValueQuery.CancelValueFiltering(100) End Sub |
The GetValueEntryAsXml method returns the current value entry for the given tag.
GetValueEntryAsXml(Tag As String, ValueInfoXml As Variant) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
A fully qualified point tag. |
|
ValueInfoXml |
Yes |
The current value entry for the tag returned as an XML string. |
Example
The following example goes through the entire process of creating a filter, starting the query, retrieving a current value entry from a point tag, and cleaning up the query.
|
Sub
Dim bCreatedOk bCreatedOk = ValueQuery.CreateValueFilter()
Dim bRunning bRunning = ValueQuery.IsValueFilterRunning()
Dim bStarted bStarted = ValueQuery.StartValueFiltering()
' retrieve the current value from a point tag (note that this ' query is designed to work with other queries that return lists ' of point tags, such as PointFacQuery) Dim bRetrieved, pvValueInfoXml bRetrieved = ValueQuery.GetValueEntryAsXml("CYGDEMO.UIS.00002109:MYPOINTTAG", pvValueInfoXml) MsgBox pvValueInfoXml
ValueQuery.CancelValueFiltering(100) End Sub |
The IsValueFilterRunning method returns true if the value query thread is running.
IsValueFilterRunning() As Boolean
The value query thread is executed after a value filter is created; therefore, after a value filter is created, this method will only return false if the filter has been canceled using CancelValueFiltering.
Example
The following example creates a value filter, checks that it is running, destroys it, and checks that it is no longer running.
|
Sub
Dim bCreatedOk bCreatedOk = ValueQuery.CreateValueFilter()
Dim bRunning bRunning = ValueQuery.IsValueFilterRunning()
MsgBox bRunning 'should be "True"
ValueQuery.CancelValueFiltering(100)
bRunning = ValueQuery.IsValueFilterRunning()
MsgBox bRunning 'should be "False"
End Sub |
The StartValueFiltering method initiates value filtering on the background thread.
StartValueFiltering() As Boolean
This method returns false if no value filter has been created.
Example
The following example goes through the entire process of creating a filter, starting the query, retrieving a current value entry from a point tag, and cleaning up the query.
|
Sub
Dim bCreatedOk bCreatedOk = ValueQuery.CreateValueFilter()
Dim bRunning bRunning = ValueQuery.IsValueFilterRunning()
Dim bStarted bStarted = ValueQuery.StartValueFiltering()
' retrieve the current value from a point tag (note that this ' query is designed to work with other queries that return lists ' of point tags, such as PointFacQuery) Dim bRetrieved, pvValueInfoXml bRetrieved = ValueQuery.GetValueEntryAsXml("CYGDEMO.UIS.00002109:MYPOINTTAG", pvValueInfoXml) MsgBox pvValueInfoXml
ValueQuery.CancelValueFiltering(100)
End Sub |