5 Replies Latest reply on Nov 2, 2017 5:18 PM by fbatista

    How to set an element attribute value with a system digital state?

    fbatista

      Hi folks,

      I tried to send a system digital state to an attribute, which is associated to a Float32 PI Point. Here is the part of the code I used for this:

       

                              Dim sysStateSet As Asset.AFEnumerationSet = OSIsoft.AF.Asset.AFEnumerationSet.SystemStateSet
                              Dim enumSystemValue As Asset.AFEnumerationValue = sysStateSet(value)
                              If enumSystemValue <> Nothing Then
                                  afValue = New Asset.AFValue(enumSystemValue, timeStamp)
                              Else
                                  Throw New Exception("Value type does not match attribute type nor the possible value existing in the system digital state set.")
                              End If
      
                               afAttr.SetValue(afValue)
      

       

      I set the "value" variable with "No Data". The objects afAttr and timeStamp have already been set.

       

      When the code is executed, I see the number 248 in the archive (which corresponds to the "No Data" system digital state number). I was expecting to see "No Data" instead.

       

      What am I doing wrong?