PointMetadata Methods
The PointMetadata object contains the following methods:
For more information, see Point State and Alarm Condition.
EvaluateAlarmState
The EvaluateAlarmState method returns the alarm condition information for the highest precedence alarm for the given point status.
Syntax
EvaluateAlarmState(BaseStatus As Integer, UserStatus As Long)
Parameters
| Parameter | Required | Description |
|---|---|---|
| BaseStatus | Yes | The base status bits. |
| UserStatus | Yes | The user status bits. |
Remarks
This method returns an array in the following order:
| 0 | Name of point state, String |
| 1 | Description of point state, String |
| 2 | Token, String |
| 3 | Display order, Integer |
| 4 | Blink method, EBlinkMethod |
| 5 | Old single color blink behavior, Boolean |
| 6 | Point state ID, Integer |
| 7 | Point Scheme, Integer |
| 8 | Point type, EPointType |
| 9 |
Single color, Integer |
| 10 | Foreground color, Integer |
| 11 | Background color, Integer |
Example
See the Point object for more information.
Sub
Option Explicit
'Create a Points object
Dim Points : Set Points = CreateObject("CxScript.Points")
'Define base status and user status values
'These values will typically come from a point’s Status and UserStatus properties.
'Refer to the Point Object in CxScript for more information.
Dim base_status : base_status="199"
Dim user_status : user_status="12648448"
'Create a PointMetaData object
Dim PointMetaData : Set PointMetaData = CreateObject("CxScript.PointMetadata")
'Create an array to hold alarm state information and issue method
Dim arrAlarmCondition : arrAlarmCondition = PointMetaData.EvaluateAlarmState(base_status, user_status)
If Not IsEmpty(arrAlarmCondition) Then
'Iterate each value of the array
Dim item
Dim strAlarmConditionItems : strAlarmConditionItems = ""
For Each item In arrAlarmCondition
strAlarmConditionItems = strAlarmConditionItems & item & vbCrLf
Next
MsgBox strAlarmConditionItems
Else
MsgBox "No alarm condition exists for provided status."
End If
'Or use a specific item
If Not IsEmpty(arrAlarmCondition) Then
'Display Description of Alarm Condition
MsgBox "Alarm Condition = " & arrAlarmCondition(1)
Else
MsgBox "No alarm condition exists for provided status."
End If
End Sub
GetAlarmPriorityCategoryDefinitions
The GetAlarmPriorityCategoryDefinitions method returns a two-dimensional array containing all alarm priority category definitions.
Syntax
GetAlarmPriorityCategoryDefinitions() As Variant
Remarks
This method returns a two-dimensional array with the following columns:
| 0 | Category ID, Integer |
| 1 | Category name, String |
| 2 | Category description, String |
| 3 | Lower bound, Integer |
| 4 | Upper bound, Integer |
| 5 | Facility info value, Integer |
| 6 | Sound value, Integer |
Example
The following example iterates the returned array and displays each set of elements in a message box.
Sub
Dim aryDefs
aryDefs = PointMetadata.GetAlarmPriorityCategoryDefinitions
Dim i, j, strMsg
For i = 0 To UBound(aryDefs, 1)
strMsg = strMsg + CStr(aryDefs(i, 0)) + ": | "
If UBound(aryDefs, 2) > 0 Then
For j = 1 To UBound(aryDefs, 2)
strMsg = strMsg + CStr(aryDefs(i, j)) + " | "
Next
End If
strMsg = strMsg + vbCr
Next
MsgBox strMsg
End Sub
GetMetadataVersion
The GetMetadataVersion method outputs metadata version info to parameters.
Syntax
GetMetadataVersion(FormatVersion As Variant, ModifiedTime As Variant, ModifiedBy As Variant) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
FormatVersion |
Yes |
An output parameter specifying the metadata format version. |
|
ModifiedTime |
Yes |
An output parameter specifying the last modified time of the metadata. |
|
ModifiedBy |
Yes |
An output parameter specifying the last user to modify the metadata. |
Remarks
This method will return true if it is successful.
Example
The following example retrieves the metadata version info and displays it in a message box.
Sub
Dim strFormatVersion, strModifiedTime, strModifiedBy, bRet
bRet = PointMetadata.GetMetadataVersion(strFormatVersion, _
strModifiedTime, strModifiedBy)
If (bRet) Then
Dim strMsg
strMsg = strFormatVersion + ", " + strModifiedTime + ", "
strMsg = strMsg + strModifiedBy
MsgBox strMsg
Else
MsgBox "Error"
End If
End Sub
GetMetadataXml
The GetMetadataXml method returns the point metadata as an XML string.
Syntax
GetMetadataXml() As String
Example
The following example writes the point metadata XML to a file.
Sub
Dim strXml
strXml = PointMetadata.GetMetadataXml
Dim fso, txtFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set txtFile = fso.CreateTextFile("c:\file.txt", True)
fso.GetAbsolutePathName("c:\file.txt")
txtFile.WriteLine(strXml)
txtFile.Close
End Sub
GetPointDataTypes
The GetPointDataTypes method returns an array of point data types as strings.
Syntax
GetPointDataTypes() As Variant
Example
The following example lists the point data types in a message box.
Sub
Dim aryDataTypes
aryDataTypes = PointMetadata.GetPointDataTypes
Dim i, strMsg
For i = 0 To UBound(aryDataTypes)
strMsg = strMsg + aryDataTypes(i) + vbCr
Next
MsgBox strMsg
End Sub
GetPointSchemes
The GetPointSchemes method returns a two-dimensional array containing all Point Scheme information.
Syntax
GetPointSchemes() As Variant
Remarks
This method returns a two-dimensional array with the following columns:
| 0 | Point Scheme ID, Integer |
| 1 | Description of Point Scheme, String |
| 2 | Default blink method, EBlinkMethod |
| 3 | Old single color blink behavior, Boolean |
| 4 | Out-of-Range action, EEnumPointOutOfRangeAction |
Example
The following example iterates the returned array and displays each set of elements in a message box.
Sub
Dim arySchemes
arySchemes = PointMetadata.GetPointSchemes
Dim i, j, strMsg
For i = 0 To UBound(arySchemes, 1)
strMsg = strMsg + CStr(arySchemes(i, 0)) + ": | "
If UBound(arySchemes, 2) > 0 Then
For j = 1 To UBound(arySchemes, 2)
strMsg = strMsg + CStr(arySchemes(i, j)) + " | "
Next
End If
strMsg = strMsg + vbCr
Next
MsgBox strMsg
End Sub
GetPointStateDefinitions
The GetPointStateDefinitions method returns a two-dimensional array containing all point state definitions.
Syntax
GetPointStateDefinitions() As Variant
Remarks
This method returns a two-dimensional array with the following columns:
| 0 | Point state ID, Integer |
| 1 | Name of point state, String |
| 2 | Description of point state, String |
| 3 | Token, String |
| 4 | Default single color, Integer |
| 5 | Default foreground color, Integer |
| 6 | Default background color, Integer |
| 7 | Display order, Integer |
| 8 | Is alarm condition?, Boolean |
Example
The following example iterates the returned array and displays each set of elements in a message box.
Sub
Dim aryDefs
aryDefs = PointMetadata.GetPointStateDefinitions
Dim i, j, strMsg
For i = 0 To UBound(aryDefs, 1)
strMsg = strMsg + CStr(aryDefs(i, 0)) + ": | "
If UBound(aryDefs, 2) > 0 Then
For j = 1 To UBound(aryDefs, 2)
strMsg = strMsg + CStr(aryDefs(i, j)) + " | "
Next
End If
strMsg = strMsg + vbCr
Next
MsgBox strMsg
End Sub
GetPointStateInfos
The GetPointStateInfos method returns a two-dimensional array containing all point state information.
Syntax
GetPointStateInfos() As Variant
Remarks
This method returns a two-dimensional array with the following columns:
| 0 | Name of point state, String |
| 1 | Description of point state, String |
| 2 | Token, String |
| 3 | Display order, Integer |
| 4 | Blink method, EBlinkMethod |
| 5 | Old single color blink behavior, Boolean |
| 6 | Point state ID, Integer |
| 7 | Point Scheme, Integer |
| 8 | Point type, EPointType |
| 9 | Single color, Integer |
| 10 | Foreground color, Integer |
| 11 | Background color, Integer |
Example
The following example iterates the returned array and displays each set of elements in a message box.
Sub
Dim aryInfos
aryInfos = PointMetadata.GetPointStateInfos
Dim i, j, strMsg
For i = 0 To UBound(aryInfos, 1)
strMsg = strMsg + CStr(aryInfos(i, 0)) + ": | "
If UBound(aryInfos, 2) > 0 Then
For j = 1 To UBound(aryInfos, 2)
strMsg = strMsg + CStr(aryInfos(i, j)) + " | "
Next
End If
strMsg = strMsg + vbCr
Next
MsgBox strMsg
End Sub
GetPointStateInstances
The GetPointStateInstances method returns a two-dimensional array containing all point state instances.
Syntax
GetPointStateInstances() As Variant
Remarks
This method returns a two-dimensional array with the following columns:
| 0 | Point Scheme, Integer |
| 1 | Point type, EPointType |
| 2 | Point state ID, Integer |
| 3 | Point state name, String |
| 4 | Point state description, String |
| 5 | Token, String |
| 6 | Single color, Int |
| 7 | Foreground color, Int |
| 8 | Background color, Int |
| 9 | Is alarm condition?, Boolean |
| 10 | Blink method, EBlinkMethod |
| 11 | Old single color blink behavior, Boolean |
| 12 | Bit matching method, EBitMatchingMethod |
Example
The following example iterates the returned array and displays each set of elements in a message box.
Sub
Dim aryInstances
aryInstances = PointMetadata.GetPointStateInstances
Dim i, j, strMsg
For i = 0 To UBound(aryInstances, 1)
strMsg = strMsg + CStr(aryInstances(i, 0)) + ": | "
If UBound(aryInstances, 2) > 0 Then
For j = 1 To UBound(aryInstances, 2)
strMsg = strMsg + CStr(aryInstances(i, j)) + " | "
Next
End If
strMsg = strMsg + vbCr
Next
MsgBox strMsg
End Sub
GetStatusBitMetadata
The GetStatusBitMetadata method returns a two-dimensional array containing all status bit metadata.
Syntax
GetStatusBitMetadata() As Variant
Remarks
This method returns a two-dimensional array with the following columns:
| 0 | Point Scheme, Integer |
| 1 | Point type, EPointType |
| 2 | Bit ID, EBitId |
| 3 | Calculation order, Integer |
| 4 | Calculation type, ECalcType |
| 5 | Is active?, Boolean |
| 6 | Point state ID, Integer |
| 7 | Status bit description, String |
| 8 | Display order, Integer |
| 9 | Is parameter 1 enabled?, Boolean |
| 10 | Parameter 1 description, String |
| 11 | Is parameter 2 enabled?, Boolean |
| 12 | Parameter 2 description, String |
Example
The following example iterates the returned array and displays each set of elements in a message box.
Sub
Dim aryMetadata
aryMetadata = PointMetadata.GetStatusBitMetadata
Dim i, j, strMsg
For i = 0 To UBound(aryMetadata, 1)
strMsg = strMsg + CStr(aryMetadata(i, 0)) + ": | "
If UBound(aryMetadata, 2) > 0 Then
For j = 1 To UBound(aryMetadata, 2)
strMsg = strMsg + CStr(aryMetadata(i, j)) + " | "
Next
End If
strMsg = strMsg + vbCr
Next
MsgBox strMsg
End Sub


