Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFAttribute.GetValue Method (AFTimeRange)

  • Last UpdatedNov 18, 2025
  • 3 minute read
AFAttribute.GetValue Method (AFTimeRange)
This method gets the value for an attribute based upon the data reference configuration and the specified AFTimeRange context in the units of the DefaultUOM for the attribute.

Namespace:  OSIsoft.AF.Asset
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public AFValue GetValue(
	AFTimeRange timeRange
)
Public Function GetValue ( 
	timeRange As AFTimeRange
) As AFValue

Dim instance As AFAttribute
Dim timeRange As AFTimeRange
Dim returnValue As AFValue

returnValue = instance.GetValue(timeRange)
public:
AFValue^ GetValue(
	AFTimeRange timeRange
)
member GetValue : 
        timeRange : AFTimeRange -> AFValue 

Parameters

timeRange
Type: OSIsoft.AF.TimeAFTimeRange
The time range context to be used when getting the attribute's value. If the time range context is not supported by this attribute's configuration, as indicated by the SupportedContexts property, then the context will be changed to an AFTime context at the end of the time range.

Return Value

Type: AFValue
Returns 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

ExceptionCondition
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.

Security note Security Note
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.

Version Information

AFSDK


See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in