AFAttribute.GetValue Method
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public AFValue GetValue()
Public Function GetValue As AFValue Dim instance As AFAttribute Dim returnValue As AFValue returnValue = instance.GetValue()
public: AFValue^ GetValue()
member GetValue : unit -> AFValue
Return Value
Type: AFValueReturns the AFValue for the attribute. If AFValue.IsGood returned by the data reference is , then the returned value is converted to the proper UOM and Type.
Exceptions
| Exception | Condition |
|---|---|
| InvalidCastException | Thrown when the conversion to the desired UOM or configured Type cannot be performed. |
Remarks
The data reference configuration specifies how to read the value of the attribute. The AFDataReference.UOM property specifies the actual UOM of the external data value referenced by this attribute.
This overload of GetValue contains no time or time range context. In this case, the time context is determined from the owning object - for example, the time range of the event frame or transfer which holds this attribute. Otherwise, the implementation of the Data Reference determines the meaning of no context. For simply configured PI Point Data References, this means the snapshot value of the PI Point on the PI Data Archive.
When obtaining values for multiple attributes, consider using one of the AFAttributes.GetValue Overload methods as it can perform more efficiently in many instances.
| You must have ReadData security rights to read an attribute value. |
If the Element associated with this attribute has more than one AFVersion associated with it and a QueryDate for the element has not been specified, then this method will invoke the call on the latest version of the element.