I am setting an AF Attribute, with a PI tag data reference “ALERT_PI” to equal the value of another AF Attribute “ALERT”. The problem that I am having is with the GetValue method, which only seems to fetch the attribute value when I initially set the object. It then holds this value in memory and uses it every subsequent time I use the GetValue method. If I change the value of the “ALERT” attribute, from the system explorer, and run the code again, the “ALERT_PI” attribute is set to the initial “ALERT” attribute value, not the new “ALERT” attribute value.
The code is:
Dim myPISystems As New PISystems
Dim myPISystem As PISystem = myPISystems("bkkhqntsp04")
Dim myDB As AFDatabase = myPISystem.Databases("TEST_AF_SERVER")
For Each myElement As AFElement In myDB.Elements
If myElement.Template.Name = "BC_01" Then
Dim Alert As AFAttribute = myElement.Attributes("ALERT")
Dim Alert_PI As AFAttribute = myElement.Attributes("ALERT_PI")
Dim attrValue As AFValue = Alert.GetValue
attrValue.Timestamp = Time.AFTime.Now
Alert_PI.DataReference.ConfigString += ";ReadOnly=False"
Thank you in advance.