AFAttribute.GetValue Method (AFTime, UOM)
- 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( AFTime time, UOM desiredUOM )
Public Function GetValue ( time As AFTime, desiredUOM As UOM ) As AFValue Dim instance As AFAttribute Dim time As AFTime Dim desiredUOM As UOM Dim returnValue As AFValue returnValue = instance.GetValue(time, desiredUOM)
public: AFValue^ GetValue( AFTime time, UOM^ desiredUOM )
member GetValue : time : AFTime * desiredUOM : UOM -> AFValue
Parameters
- time
- Type: OSIsoft.AF.TimeAFTime
The time context to be used when getting the attribute's value. If the time context is not supported by this attribute's configuration, as indicated by the SupportedContexts property, then the context will be changed to no context. - desiredUOM
- Type: OSIsoft.AF.UnitsOfMeasureUOM
The desired unit of measure for the returned value. If , then the value is returned in the unit of measure specified by the DefaultUOM property.
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.
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 version of the element corresponding to the specified context.