I'm trying to write a user interface to manage some PI Alarms through PI SDK in VBA.
I've hit a bit of a roadblock when it comes to trying to modify the alarm test and action attributes. PI Alarms uses attributes in the point, Test1, Test2, Test3, and Test4 to store the condition tests for the alarm. I've gotten so far as to read the values of these attributes in my application, but PI SDK reports that these attributes are read-only, and therefore the SDK fails when it tries to modify the attributes, like this:
Code:
Dim nvs As NamedValues
Dim nvs2 As NamedValues
Dim tag As String
Set nvs = New NamedValues
Set nvs2 = New NamedValues
tag = TextBox1.Text
nvs.Add TextBox2.Text, TextBox3.Text
s.PIPoints(tag).PointAttributes.ModifyAttributes nvs, nvs2
This is just from a test form that I rigged up, where TextBox2 contains the name of the attribute (e.g. "test1") and TextBox3 contains the value to write (e.g. "LT(40)").
In this code, the ModifyAttributes call fails reporting that the attributes are read-only. If I get the Readonly property for PointAttributes, it reports that this point attribute set is indeed read-only.
Surely there should be some way to modify the test conditions for a PI Alarm point? I thought about using a reference point and hardcode the conditions, but this is not nearly as flexible as being able to work with the four individual alarm limits themselves.