PointFacQuery Methods

The PointFacQuery object contains the following methods:

Note: Some of the examples in this topic use the WScript.Sleep statement, which is not available for use when scripting in CygNet Studio. Use TheView's EventTimer instead.

CancelPointFacFiltering

The CancelPointFacFiltering method cancels the filtering of points.

Syntax

CancelPointFacFiltering()

Example

The following example cleans up the query after it is finished, by canceling the filtering destroying the filter.

Copy
CancelPointFacFiltering
Sub
 
    ' point/fac query is finished
    PointFacQuery.CancelPointFacFiltering()
    PointFacQuery.DestroyPointFacFilter(100)
 
End Sub

Back to top

ClearQueryResults

The ClearQueryResults method clears the results of a previous query and initializes the processing flags. The query (filter) itself is not cleared.

Syntax

ClearQueryResults()

Remark

Clearing the results of a previous query is good programming practice if multiple queries are to be performed.

Example

The following example addresses clearing the query results before retrieving data from the query.

Copy
ClearQueryResults
Sub
 
    ' query is all set up
    While bIsFiltering
     
        WScript.Sleep(1000)
         
        ' call before retrieving data
        PointFacQuery.ClearQueryResults()
         
        ' retrieve data, etc.
    Wend
 
End Sub

Back to top

CreatePointFacFilter

The CreatePointFacFilter method creates a new point/fac filter thread.

Syntax

CreatePointFacFilter(UpdateInterval As Integer) As Boolean

Parameters

Parameter Required Description

UpdateInterval

Yes

The periodic run interval in seconds.

Example

The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Copy
CreatePointFacFilter
Sub
 
    '-----------------SETUP------------------
     
    Dim bCreatedOk
    bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
     
    Dim bIsRunning
    bIsRunning = PointFacQuery.IsPointFacFilterRunning()
     
    PointFacQuery.ClearQueryResults
     
    Dim bSetServices
    bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
     
    'set the FAC filter from an existing XML (see the documentation for
    'SetFacilityFilter for an example of an XML filter)
    Dim bSetFilter
    bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
     
    'set the PNT filter from an existing XML (see the documentation for
    'SetPointFilter for an example of an XML filter)
    bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
     
    Dim bNotificationSet
    bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
     
    '-----------------EXECUTION------------------
     
    Dim bFilteringStarted
    bFilteringStarted = PointFacQuery.StartPointFacFiltering
     
    WScript.Sleep(5000) 'simulating polling the notification point
     
    '-----------------RESULTS------------------
     
    Dim pvTagList, bGotList
    pvTagList = ""
    bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
      
    Dim nSize, bGotSize
    nSize = 0
    bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
     
    If nSize > 0 Then
     
    Dim strTag, pvInfoXml, bRetrieved, iRec
    For iRec = 0 To UBound(pvTagList)
     
        strTag = pvTagList(iRec)
         
        pvInfoXml = ""
        bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml)
        MsgBox pvInfoXml
         
        pvInfoXml = ""
        bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml)
        MsgBox pvInfoXml
         
        Next
         
        'clear the query and the cache
        PointFacQuery.ClearQueryResults
     
    End If
     
    PointFacQuery.CancelPointFacFiltering()
    PointFacQuery.DestroyPointFacFilter(100)
 
End Sub

Back to top

DestroyPointFacFilter

The DestroyPointFacFilter method terminates execution of the filter thread, and waits for the specified number of seconds.

Syntax

DestroyPointFacFilter(TimeToWaitInSeconds As Integer) As Boolean

Parameters

Parameter Required Description

TimeToWaitInSeconds

Yes

The number of seconds to wait for the point fac query to terminate. This value must be within the range [1 - 100].

Remark

This method will hang for the specified number of seconds while the filter thread terminates. If the filter thread has not terminated by the time the interval has expired, this method will return false and the filter 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 cleans up the query after it is finished, by canceling the filtering and destroying the filter.

Copy
DestroyPointFacFilter
Sub
 
    ' point/fac query is finished
    PointFacQuery.CancelPointFacFiltering()
    PointFacQuery.DestroyPointFacFilter(100)
 
End Sub

Back to top

GetFilteredPointList

The GetFilteredPointList method returns the list of filtered points as fully qualified point tags.

Syntax

GetFilteredPointList(SiteSvcKeyList As Array) As Boolean

Parameters

Parameter Required Description

SiteSvcKeyList

Yes

A list of fully qualified point tags representing the filtered points.

Remark

After querying is complete, this method is used in conjunction with GetPointInfoAsXml and/or GetPointCommentAsXml to display the results of the query.

Example

The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Copy
GetFilteredPointList
Sub
 
    '-----------------SETUP------------------
     
    Dim bCreatedOk
    bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
     
    Dim bIsRunning
    bIsRunning = PointFacQuery.IsPointFacFilterRunning()
     
    PointFacQuery.ClearQueryResults
     
    Dim bSetServices
    bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
     
    'set the FAC filter from an existing XML (see the documentation for
    'SetFacilityFilter for an example of an XML filter)
    Dim bSetFilter
    bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
     
    'set the PNT filter from an existing XML (see the documentation for
    'SetPointFilter for an example of an XML filter)
    bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
     
    Dim bNotificationSet
    bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
     
    '-----------------EXECUTION------------------
     
    Dim bFilteringStarted
    bFilteringStarted = PointFacQuery.StartPointFacFiltering
     
    WScript.Sleep(5000) 'simulating polling the notification point
     
    '-----------------RESULTS------------------
     
    Dim pvTagList, bGotList
    pvTagList = ""
    bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
      
    Dim nSize, bGotSize
    nSize = 0
    bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
     
    If nSize > 0 Then
     
        Dim strTag, pvInfoXml, bRetrieved, iRec
        For iRec = 0 To UBound(pvTagList)
         
            strTag = pvTagList(iRec)
             
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                Next
                 
                'clear the query and the cache
                PointFacQuery.ClearQueryResults
         
    End If
     
    PointFacQuery.CancelPointFacFiltering()
    PointFacQuery.DestroyPointFacFilter(100)
 
End Sub

Back to top

GetFilteredPointListSize

The GetFilteredPointListSize method returns the size of the filtered point list as an integer

Syntax

GetFilteredPointListSize(Size As Integer) As Boolean

Parameters

Parameter Required Description

Size

Yes

The size of the filtered point list.

Remark

The filtered point list itself can be obtained via GetFilteredPointList.

Example

The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Copy
GetFilteredPointListSize
Sub
 
    '-----------------SETUP------------------
     
    Dim bCreatedOk
    bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
     
    Dim bIsRunning
    bIsRunning = PointFacQuery.IsPointFacFilterRunning()
     
    PointFacQuery.ClearQueryResults
     
    Dim bSetServices
    bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
     
    'set the FAC filter from an existing XML (see the documentation for
    'SetFacilityFilter for an example of an XML filter)
    Dim bSetFilter
    bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
     
    'set the PNT filter from an existing XML (see the documentation for
    'SetPointFilter for an example of an XML filter)
    bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
     
    Dim bNotificationSet
    bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
     
    '-----------------EXECUTION------------------
     
    Dim bFilteringStarted
    bFilteringStarted = PointFacQuery.StartPointFacFiltering
     
    WScript.Sleep(5000) 'simulating polling the notification point
     
    '-----------------RESULTS------------------
     
    Dim pvTagList, bGotList
    pvTagList = ""
    bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
      
    Dim nSize, bGotSize
    nSize = 0
    bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
     
    If nSize > 0 Then
     
        Dim strTag, pvInfoXml, bRetrieved, iRec
        For iRec = 0 To UBound(pvTagList)
         
            strTag = pvTagList(iRec)
             
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                Next
                 
                'clear the query and the cache
                PointFacQuery.ClearQueryResults
     
    End If
     
    PointFacQuery.CancelPointFacFiltering()
    PointFacQuery.DestroyPointFacFilter(100)
 
End Sub

Back to top

GetPointCommentAsXml

The GetPointCommentAsXml method returns the point comment for the given tag.

Syntax

GetPointCommentAsXml(Tag As String, PointCommentXml As Variant) As Boolean

Parameters

Parameter Required Description

Tag

Yes

A fully qualified point tag.

PointCommentXml

Yes

The point comment for the tag returned as an XML string.

Remark

After querying is complete, this method is used in conjunction with GetFilteredPointList to display the results of the query.

Example

The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Copy
GetPointCommentAsXml
Sub
 
    '-----------------SETUP------------------
     
    Dim bCreatedOk
    bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
     
    Dim bIsRunning
    bIsRunning = PointFacQuery.IsPointFacFilterRunning()
     
    PointFacQuery.ClearQueryResults
     
    Dim bSetServices
    bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
     
    'set the FAC filter from an existing XML (see the documentation for
    'SetFacilityFilter for an example of an XML filter)
    Dim bSetFilter
    bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
     
    'set the PNT filter from an existing XML (see the documentation for
    'SetPointFilter for an example of an XML filter)
    bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
     
    Dim bNotificationSet
    bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
     
    '-----------------EXECUTION------------------
     
    Dim bFilteringStarted
    bFilteringStarted = PointFacQuery.StartPointFacFiltering
     
    WScript.Sleep(5000) 'simulating polling the notification point
     
    '-----------------RESULTS------------------
     
    Dim pvTagList, bGotList
    pvTagList = ""
    bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
      
    Dim nSize, bGotSize
    nSize = 0
    bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
     
    If nSize > 0 Then
     
        Dim strTag, pvInfoXml, bRetrieved, iRec
        For iRec = 0 To UBound(pvTagList)
         
            strTag = pvTagList(iRec)
             
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                Next
                 
                'clear the query and the cache
                PointFacQuery.ClearQueryResults
     
    End If
     
    PointFacQuery.CancelPointFacFiltering()
    PointFacQuery.DestroyPointFacFilter(100)
 
End Sub

Back to top

GetPointInfoAsXml

The GetPointInfoAsXml method returns point information for the given tag.

Syntax

GetPointInfoAsXml(Tag As String, PointInfoXml As Variant) As Boolean

Parameters

Parameter Required Description

Tag

Yes

A fully qualified point tag.

PointInfoXml

Yes

The point information for the tag returned as an XML string.

Remark

After querying is complete, this method is used in conjunction with GetFilteredPointList to display the results of the query.

Example

The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Copy
GetPointInfoAsXml
Sub
 
    '-----------------SETUP------------------
     
    Dim bCreatedOk
    bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
     
    Dim bIsRunning
    bIsRunning = PointFacQuery.IsPointFacFilterRunning()
     
    PointFacQuery.ClearQueryResults
     
    Dim bSetServices
    bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
     
    'set the FAC filter from an existing XML (see the documentation for
    'SetFacilityFilter for an example of an XML filter)
    Dim bSetFilter
    bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
     
    'set the PNT filter from an existing XML (see the documentation for
    'SetPointFilter for an example of an XML filter)
    bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
     
    Dim bNotificationSet
    bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
     
    '-----------------EXECUTION------------------
     
    Dim bFilteringStarted
    bFilteringStarted = PointFacQuery.StartPointFacFiltering
     
    WScript.Sleep(5000) 'simulating polling the notification point
     
    '-----------------RESULTS------------------
     
    Dim pvTagList, bGotList
    pvTagList = ""
    bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
      
    Dim nSize, bGotSize
    nSize = 0
    bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
     
    If nSize > 0 Then
     
        Dim strTag, pvInfoXml, bRetrieved, iRec
        For iRec = 0 To UBound(pvTagList)
         
            strTag = pvTagList(iRec)
             
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                Next
                 
                'clear the query and the cache
                PointFacQuery.ClearQueryResults
     
    End If
     
    PointFacQuery.CancelPointFacFiltering()
    PointFacQuery.DestroyPointFacFilter(100)
 
End Sub

Back to top

IsPointFacFilterFiltering

The IsPointFacFilterFiltering method returns true if the entire query process has been set up and is enabled to run.

Syntax

IsPointFacFilterFiltering() As Boolean

Remark

This method will return true after a successful call to StartPointFacFiltering. Once the filtering has begun, this method will only return false if the filtering has been canceled using CancelPointFacFiltering, or if the filter has been destroyed using DestroyPointFacFilter.

Example

The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Copy
IsPointFacFilterFiltering
Sub
 
    '-----------------SETUP------------------
     
    Dim bCreatedOk
    bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
     
    Dim bIsRunning
    bIsRunning = PointFacQuery.IsPointFacFilterRunning()
     
    PointFacQuery.ClearQueryResults
     
    Dim bSetServices
    bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
     
    'set the FAC filter from an existing XML (see the documentation for
    'SetFacilityFilter for an example of an XML filter)
    Dim bSetFilter
    bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
     
    'set the PNT filter from an existing XML (see the documentation for
    'SetPointFilter for an example of an XML filter)
    bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
     
    Dim bNotificationSet
    bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
     
    '-----------------EXECUTION------------------
     
    Dim bFilteringStarted
    bFilteringStarted = PointFacQuery.StartPointFacFiltering
     
    WScript.Sleep(5000) 'simulating polling the notification point
     
    '-----------------RESULTS------------------
     
    Dim pvTagList, bGotList
    pvTagList = ""
    bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
      
    Dim nSize, bGotSize
    nSize = 0
    bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
     
    If nSize > 0 Then
     
        Dim strTag, pvInfoXml, bRetrieved, iRec
        For iRec = 0 To UBound(pvTagList)
         
            strTag = pvTagList(iRec)
         
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                Next
                 
                'clear the query and the cache
                PointFacQuery.ClearQueryResults
     
    End If
     
    PointFacQuery.CancelPointFacFiltering()
    PointFacQuery.DestroyPointFacFilter(100)
 
End Sub

Back to top

IsPointFacFilterRunning

The IsPointFacFilterFiltering method returns true if the point fac query thread is running.

Syntax

IsPointFacFilterRunning() As Boolean

Remark

The point fac query thread is executed after a point fac filter is created; therefore, after a point fac filter is created, this method will only return false if the filter has been destroyed using DestroyPointFacFilter.

Example

The following example creates a point fac filter, checks that it is running, destroys it, and checks that it is no longer running.

Copy
IsPointFacFilterRunning
Sub
 
    Dim bCreatedOk
    bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
     
    Dim bRunning
    bRunning = PointFacQuery.IsPointFacFilterRunning()
     
    MsgBox bRunning 'should be "True"
     
    PointFacQuery.DestroyPointFacFilter(100)
     
    bRunning = PointFacQuery.IsPointFacFilterRunning()
     
    MsgBox bRunning 'should be "False"
 
End Sub

Back to top

SetCvsSiteServices

The SetCvsSiteServices method defines the list of CVS site services for the point fac filter.

Syntax

SetCvsSiteServices(SiteServices As String) As Boolean

Parameters

Parameter Required Description

SiteServices

Yes

A semicolon-delimited list of CVS Site.Services (for example, "CYGDEMO.UIS;CYGDEMO.UIS1")

Remark

This method will only return false if a filter has not yet been created.

Example

The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Copy
SetCvsSiteServices
Sub
 
    '-----------------SETUP------------------
     
    Dim bCreatedOk
    bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
     
    Dim bIsRunning
    bIsRunning = PointFacQuery.IsPointFacFilterRunning()
     
    PointFacQuery.ClearQueryResults
     
    Dim bSetServices
    bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
     
    'set the FAC filter from an existing XML (see the documentation for
    'SetFacilityFilter for an example of an XML filter)
    Dim bSetFilter
    bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
     
    'set the PNT filter from an existing XML (see the documentation for
    'SetPointFilter for an example of an XML filter)
    bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
     
    Dim bNotificationSet
    bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
     
    '-----------------EXECUTION------------------
     
    Dim bFilteringStarted
    bFilteringStarted = PointFacQuery.StartPointFacFiltering
     
    WScript.Sleep(5000) 'simulating polling the notification point
     
    '-----------------RESULTS------------------
     
    Dim pvTagList, bGotList
    pvTagList = ""
    bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
      
    Dim nSize, bGotSize
    nSize = 0
    bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
     
    If nSize > 0 Then
     
        Dim strTag, pvInfoXml, bRetrieved, iRec
        For iRec = 0 To UBound(pvTagList)
         
            strTag = pvTagList(iRec)
             
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                Next
                 
                'clear the query and the cache
                PointFacQuery.ClearQueryResults
     
    End If
     
    PointFacQuery.CancelPointFacFiltering()
    PointFacQuery.DestroyPointFacFilter(100)
 
End Sub

Back to top

SetFacilityFilter

The SetFacilityFilter method sets the facility filter from an XML string.

Syntax

SetFacilityFilterAsXml(XmlFilter As String) As Boolean

Parameters

Parameter Required Description

XmlFilter

Yes

The XML string representing the facility filter to be set.

Remark

This method returns false if the XML filter is invalid.

Example

The following is an example of an XML facility filter.

Copy
Facility Filter XML
<ExportedRules exportTime='8/17/2024 11:26:44.630' ruleDataIdentifier='FAC Rules'>
    <Rules enabled='true' inverted='false' op='1' name=''>
        <Rule enabled='true' name='' referenceAttr='0' compareToType='0' value='GENFAC' operator='=' qualifer='Case Sensitive'>
            <compareItem attr='facility_type' />
        </Rule>
        <Rule enabled='true' name='' referenceAttr='0' compareToType='0' value='true' operator='=' qualifer='Case Sensitive'>
            <compareItem attr='facility_is_ref_any' />
        </Rule>
    </Rules>
</ExportedRules>

 

Note:
The XML for the filter rule uses the spelling "qualifer=" rather than "qualifier=". See Adding Filter Rule Definitions for an explanation of this discrepancy.

This filter will select all points for facilities for which (facility_type = "GENFAC" AND facility_is_ref_any = "true"). Note that the "op='1'" attribute specifies that the rules are ANDed. To OR a set of rules, use "op='0'". For a complete list of FAC XML property names, see FAC XML Attributes.

Example

The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Copy
SetFacilityFilter
Sub
 
    '-----------------SETUP------------------
     
    Dim bCreatedOk
    bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
     
    Dim bIsRunning
    bIsRunning = PointFacQuery.IsPointFacFilterRunning()
     
    PointFacQuery.ClearQueryResults
     
    Dim bSetServices
    bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
     
    'set the FAC filter from an existing XML (see the documentation for
    'SetFacilityFilter for an example of an XML filter)
    Dim bSetFilter
    bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
     
    'set the PNT filter from an existing XML (see the documentation for
    'SetPointFilter for an example of an XML filter)
    bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
     
    Dim bNotificationSet
    bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
     
    '-----------------EXECUTION------------------
     
    Dim bFilteringStarted
    bFilteringStarted = PointFacQuery.StartPointFacFiltering
     
    WScript.Sleep(5000) 'simulating polling the notification point
     
    '-----------------RESULTS------------------
     
    Dim pvTagList, bGotList
    pvTagList = ""
    bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
      
    Dim nSize, bGotSize
    nSize = 0
    bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
     
    If nSize > 0 Then
     
        Dim strTag, pvInfoXml, bRetrieved, iRec
        For iRec = 0 To UBound(pvTagList)
         
            strTag = pvTagList(iRec)
             
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                Next
                 
                'clear the query and the cache
                PointFacQuery.ClearQueryResults
     
    End If
     
    PointFacQuery.CancelPointFacFiltering()
    PointFacQuery.DestroyPointFacFilter(100)
 
End Sub

Back to top

SetNotificationPoint

The SetNotificationPoint method sets the CVS point which will contain a notification of when the queries have completed.

Syntax

SetNotificationPoint(Tag As String) As Boolean

Parameters

Parameter Required Description

Tag

Yes

The CVS tag of the point to be used for notifications (for example, "CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT").

Remark

This method will return false if the specified tag is invalid. Note that this method does not actually create a CVS point. A CVS point with the specified tag must exist prior to starting alarm filtering in order for CVS notifications to succeed.

Example

The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Copy
SetNotificationPoint
Sub
 
    '-----------------SETUP------------------
     
    Dim bCreatedOk
    bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
     
    Dim bIsRunning
    bIsRunning = PointFacQuery.IsPointFacFilterRunning()
     
    PointFacQuery.ClearQueryResults
     
    Dim bSetServices
    bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
     
    'set the FAC filter from an existing XML (see the documentation for
    'SetFacilityFilter for an example of an XML filter)
    Dim bSetFilter
    bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
     
    'set the PNT filter from an existing XML (see the documentation for
    'SetPointFilter for an example of an XML filter)
    bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
     
    Dim bNotificationSet
    bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
     
    '-----------------EXECUTION------------------
     
    Dim bFilteringStarted
    bFilteringStarted = PointFacQuery.StartPointFacFiltering
     
    WScript.Sleep(5000) 'simulating polling the notification point
     
    '-----------------RESULTS------------------
     
    Dim pvTagList, bGotList
    pvTagList = ""
    bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
      
    Dim nSize, bGotSize
    nSize = 0
    bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
     
    If nSize > 0 Then
     
        Dim strTag, pvInfoXml, bRetrieved, iRec
        For iRec = 0 To UBound(pvTagList)
         
            strTag = pvTagList(iRec)
             
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                Next
                 
                'clear the query and the cache
                PointFacQuery.ClearQueryResults
     
    End If
     
    PointFacQuery.CancelPointFacFiltering()
    PointFacQuery.DestroyPointFacFilter(100)
 
End Sub

Back to top

SetPointFilter

The SetPointFilter method sets the point filter from an XML string.

Syntax

SetPointFilter(XmlFilter As String) As Boolean

Parameters

Parameter Required Description

XmlFilter

Yes

The XML string representing the point filter to be set.

Remark

This method returns false if the XML filter is invalid.

Example

The following is an example of an XML point filter.

Copy
SetPointFilter
<ExportedRules exportTime='8/17/2024 11:05:13.230' ruleDataIdentifier='PNT Rules'>
    <Rules enabled='true' inverted='false' op='1' name=''>
        <Rule enabled='true' name='' referenceAttr='0' compareToType='0' value='CYGDEMO.UIS' operator='=' qualifer='Case Insensitive'>
            <compareItem attr='siteservice' />
        </Rule>
        <Rule enabled='true' name='' referenceAttr='0' compareToType='0' value='true' operator='=' qualifer='Case Insensitive'>
            <compareItem attr='hascomment' />
        </Rule>
    </Rules>
</ExportedRules>

 

Note:
The XML for the filter rule uses the spelling "qualifer=" rather than "qualifier=". See Adding Filter Rule Definitions for an explanation of this discrepancy.

This filter will select all points for which (siteservice = "CYGDEMO.UIS" AND hascomment = "true"). Note that the "op='1'" attribute specifies that the rules are ANDed. To OR a set of rules, use "op='0'". For a complete list of PNT XML property names, see PNT XML Attributes.

Example

The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Copy
SetPointFilter
Sub
 
    '-----------------SETUP------------------
     
    Dim bCreatedOk
    bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
     
    Dim bIsRunning
    bIsRunning = PointFacQuery.IsPointFacFilterRunning()
     
    PointFacQuery.ClearQueryResults
     
    Dim bSetServices
    bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
     
    'set the FAC filter from an existing XML (see the documentation for
    'SetFacilityFilter for an example of an XML filter)
    Dim bSetFilter
    bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
     
    'set the PNT filter from an existing XML (see the documentation for
    'SetPointFilter for an example of an XML filter)
    bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
     
    Dim bNotificationSet
    bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
     
    '-----------------EXECUTION------------------
     
    Dim bFilteringStarted
    bFilteringStarted = PointFacQuery.StartPointFacFiltering
     
    WScript.Sleep(5000) 'simulating polling the notification point
     
    '-----------------RESULTS------------------
     
    Dim pvTagList, bGotList
    pvTagList = ""
    bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
      
    Dim nSize, bGotSize
    nSize = 0
    bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
     
    If nSize > 0 Then
     
        Dim strTag, pvInfoXml, bRetrieved, iRec
        For iRec = 0 To UBound(pvTagList)
         
            strTag = pvTagList(iRec)
             
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                Next
                 
                'clear the query and the cache
                PointFacQuery.ClearQueryResults
     
    End If
     
    PointFacQuery.CancelPointFacFiltering()
    PointFacQuery.DestroyPointFacFilter(100)
 
End Sub

Back to top

StartPointFacFiltering

The StartPointFacFiltering method initiates point fac filtering on the background thread.

Syntax

StartPointFacFiltering() As Boolean

Remark

This method returns false if no point fac filter has been created.

It is good practice to clear any previous query results with ClearQueryResults before calling this method.

Example

The following example goes through the entire process of creating a filter, setting the CVS site services, setting facility and point filters, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Copy
StartPointFacFiltering
Sub
 
    '-----------------SETUP------------------
     
    Dim bCreatedOk
    bCreatedOk = PointFacQuery.CreatePointFacFilter(5)
     
    Dim bIsRunning
    bIsRunning = PointFacQuery.IsPointFacFilterRunning()
     
    PointFacQuery.ClearQueryResults
     
    Dim bSetServices
    bSetServices = PointFacQuery.SetCvsSiteServices("CYGDEMO.UIS")
     
    'set the FAC filter from an existing XML (see the documentation for
    'SetFacilityFilter for an example of an XML filter)
    Dim bSetFilter
    bSetFilter = PointFacQuery.SetFacilityFilter(g_xmlFacFilter)
     
    'set the PNT filter from an existing XML (see the documentation for
    'SetPointFilter for an example of an XML filter)
    bSetFilter = PointFacQuery.SetPointFilter(g_xmlPntFilter)
     
    Dim bNotificationSet
    bNotificationSet = PointFacQuery.SetNotificationPoint("CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT")
     
    '-----------------EXECUTION------------------
     
    Dim bFilteringStarted
    bFilteringStarted = PointFacQuery.StartPointFacFiltering
     
    WScript.Sleep(5000) 'simulating polling the notification point
     
    '-----------------RESULTS------------------
     
    Dim pvTagList, bGotList
    pvTagList = ""
    bGotList = PointFacQuery.GetFilteredPointList(pvTagList)
      
    Dim nSize, bGotSize
    nSize = 0
    bGotSize = PointFacQuery.GetFilteredPointListSize(nSize)
     
    If nSize > 0 Then
     
        Dim strTag, pvInfoXml, bRetrieved, iRec
        For iRec = 0 To UBound(pvTagList)
         
            strTag = pvTagList(iRec)
             
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointInfoAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                pvInfoXml = ""
                bRetrieved = PointFacQuery.GetPointCommentAsXml(strTag, pvInfoXml)
                MsgBox pvInfoXml
                 
                Next
                 
                'clear the query and the cache
                PointFacQuery.ClearQueryResults
     
    End If
     
    PointFacQuery.CancelPointFacFiltering()
    PointFacQuery.DestroyPointFacFilter(100)
 
End Sub

Back to top