AFAttribute.GetValues Method (AFTimeRange, Int32, UOM)
- Last UpdatedNov 18, 2025
- 4 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 AFValues GetValues( AFTimeRange timeRange, int numberOfValues, UOM desiredUOM )
Public Function GetValues ( timeRange As AFTimeRange, numberOfValues As Integer, desiredUOM As UOM ) As AFValues Dim instance As AFAttribute Dim timeRange As AFTimeRange Dim numberOfValues As Integer Dim desiredUOM As UOM Dim returnValue As AFValues returnValue = instance.GetValues(timeRange, numberOfValues, desiredUOM)
public: AFValues^ GetValues( AFTimeRange timeRange, int numberOfValues, UOM^ desiredUOM )
member GetValues : timeRange : AFTimeRange * numberOfValues : int * desiredUOM : UOM -> AFValues
Parameters
- timeRange
- Type: OSIsoft.AF.TimeAFTimeRange
The time-range to be used when getting the attribute's collection of values. - numberOfValues
- Type: SystemInt32
The number of values desired. The behavior of GetValues varies based on the value of this parameter:- If 0, then all recorded values within the timeRange will be returned with an interpolated value at the start and end time, if possible.
- If the number of values requested is less than zero, then if supported, the Data Reference will return evenly spaced interpolated values across the timeRange, with a value returned at both end points of the time range. For example, specifying -25 over a 24 hour period will produce an hourly value.
- If the number of values requested is greater than zero, the method will behave like the PlotValues method. This method is designed to return a set of values over a time period that will produce the most accurate plot while minimizing the amount of data returned. The number of intervals specifies the number of pixels that need to be represented in the time period. For each interval, the data available is examined and significant values are returned. Each interval can produce up to 5 values if they are unique, the value at the beginning of the interval, the last value, the highest value, the lowest value and at most one exceptional point (bad value and/or annotated value). If no data is available in an interval, then no value is generated for that interval. As a result, the method may return more or fewer values than the number of values requested, depending on the distribution of recorded values over the time range. For Data References which use multiple PI Point sources, the list of values returned in each interval may be greater than 5 depending upon the data reference implementation.
- desiredUOM
- Type: OSIsoft.AF.UnitsOfMeasureUOM
The desired unit of measure for the returned values. If not specified or , then the values are returned in the unit of measure specified by the DefaultUOM property.
Return Value
Type: AFValuesReturns the collection of values for the attribute sorted in increasing time order if the StartTime of the timeRange is less than or equal its EndTime. Otherwise the order is reversed. If a AFDataReference is not configured for this attribute or the configured data reference does not support the AFDataReference.GetValues method, then this method defaults to returning a single value in the returned collection for each of its versions. These are the values returned by the GetValue Overload methods for each of its versions.
Remarks
The returned collection of AFValue objects represent the values of the attribute within the specified context. See GetValue Overload for more specific information on UOM and type conversion.
If the Element has more than AFVersion associated with it and a QueryDate for the element has not been specified, then this method will break the time-range of the context across each corresponding version of the object in order to read the values with the correct configuration. However, for each AFValue returned (for example, when using interpolated or configured summary calls), only one element version will be used to compute a single AFValue.