AnsweredAssumed Answered

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

Question asked by fabiano.batista on Nov 2, 2017
Latest reply on Nov 2, 2017 by fabiano.batista

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)
                            Throw New Exception("Value type does not match attribute type nor the possible value existing in the system digital state set.")
                        End If


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?