AFListData.InterpolatedValuesAtTimes Method
- Last UpdatedNov 18, 2025
- 6 minute read
- PI System
- AF SDK 2024 R2
- Developer
Namespace: OSIsoft.AF.Data
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public IEnumerable<AFValues> InterpolatedValuesAtTimes( IList<AFTime> times, string filterExpression, bool includeFilteredValues, PIPagingConfiguration pagingConfig )
Public Function InterpolatedValuesAtTimes ( times As IList(Of AFTime), filterExpression As String, includeFilteredValues As Boolean, pagingConfig As PIPagingConfiguration ) As IEnumerable(Of AFValues) Dim instance As AFListData Dim times As IList(Of AFTime) Dim filterExpression As String Dim includeFilteredValues As Boolean Dim pagingConfig As PIPagingConfiguration Dim returnValue As IEnumerable(Of AFValues) returnValue = instance.InterpolatedValuesAtTimes(times, filterExpression, includeFilteredValues, pagingConfig)
public: IEnumerable<AFValues^>^ InterpolatedValuesAtTimes( IList<AFTime>^ times, String^ filterExpression, bool includeFilteredValues, PIPagingConfiguration^ pagingConfig )
member InterpolatedValuesAtTimes : times : IList<AFTime> * filterExpression : string * includeFilteredValues : bool * pagingConfig : PIPagingConfiguration -> IEnumerable<AFValues>
Parameters
- times
- Type: System.Collections.GenericIListAFTime
List of timestamps at which to retrieve interpolated values - filterExpression
- Type: SystemString
A filter expression that follows the performance equation syntax. - includeFilteredValues
- Type: SystemBoolean
Specify to indicate that values which fail the filter criteria are present in the returned data at the times where they occurred with a value set to a "Filtered" enumeration value with bad status. Repeated consecutive failures are omitted. - pagingConfig
- Type: OSIsoft.AF.PIPIPagingConfiguration
Contains the paging configuration parameters for the request.
Return Value
Type: IEnumerableAFValuesAn enumerable of AFValues for each AFAttribute in the list. The results are not guaranteed to match the order of the AFAttributeList, and duplicate attributes in the list will not produce a duplicate result. The results can be mapped back to the corresponding attribute using the Attribute property on each result.
The order of the results are predictable; however, if you need the results in the same order as the attribute list, then consider using a dictionary keyed by attribute to construct a list in the same order.
The attributes in the list are broken up by data reference. If the data reference supports bulk calls, then the bulk call is used to improve performance and reduce roundtrips to the server. PI Point attributes are then broken up a second time by their corresponding PI Data Archive. A bulk call is made against each PI Data Archive in parallel. The results are made available as they are returned from the PI Data Archive in the order that the bulk calls were made.
The following example shows a list of attributes including duplicates from three different PI Data Archives, and two table lookups:
| Attribute | PI Data Archive | Data Reference |
|---|---|---|
| Lobby Room Temperature | Contoso | PI Point |
| Lobby Room Temperature | Northwind | PI Point |
| Target Lobby Room Temperature | N/A | Table Lookup |
| Lobby Room Temperature | Contoso | PI Point |
| Lobby Room Temperature | AdventureWorks | PI Point |
| Maximum Lobby Room Temperature | N/A | Table Lookup |
| Kitchen Room Temperature | Contoso | PI Point |
This table shows the order that the results would be returned:
| Attribute | PI Data Archive | Data Reference |
|---|---|---|
| Lobby Room Temperature | Contoso | PI Point |
| Kitchen Room Temperature | Contoso | PI Point |
| Lobby Room Temperature | Northwind | PI Point |
| Lobby Room Temperature | AdventureWorks | PI Point |
| Target Lobby Room Temperature | N/A | Table Lookup |
| Maximum Lobby Room Temperature | N/A | Table Lookup |
Since the first attribute is on the Contoso PI Data Archive, it is the first PI Data Archive to receive a bulk call; therefore, all Contoso attributes will be returned first. Duplicate attributes do not produce a duplicate result, so the duplicate Contoso Lobby Room Temperature does not produce a second return value. After the Contoso attributes have been returned, the Northwind attributes are returned followed by the AdventureWorks attributes.
After attributes supporting bulk calls have been returned, the remaining attributes are iterated and evaluated, so the table lookups are returned last in the order they were in the original list.
| Several factors can cause the values to come back in a different order, so a dictionary should be used to restructure the results if order is important. If an error occurs or the request range spans multiple element versions, the SDK will fall back to an iterative approach. This would cause the PI Point attributes to be returned in the same order as they were in the list. Finally, calls that include a filter expression that resolve differently for each attribute such as "'.' > 1" will also cause the SDK to fall back to an iterative approach. |
Exceptions
| Exception | Condition |
|---|---|
| OperationCanceledException | When an error occurs that prevents the operation from proceeding. Check the Error property on the pagingConfig object for more specific error information. |
| ArgumentNullException | The times is . |
| ArgumentException | The times list must be monotonic. |
| ArgumentNullException | When pagingConfig is . |
Remarks
| Results are available for enumeration as they are returned from the data source for better performance. |
| The returned enumerable collection can be enumerated one time. As the collection is enumerated, the internal data structures are disposed. Any attempt to reset or enumerate a second time will result in an exception. |
| This method, property, or class is not available in the legacy .NET 3.5 version of the SDK. |
| You must have ReadData security rights to read a data value. |
| This call might use a background task to complete some of its work. See the Threading Overview for some matters to consider when execution transitions to another thread. |
Examples
// Holds the results keyed on the associated attribute Dictionary<AFAttribute, AFValues> resultsMap = new Dictionary<AFAttribute, AFValues>(); // Results should be sent back for 100 tags in each page. PIPagingConfiguration config = new PIPagingConfiguration(PIPageType.TagCount, 100); try { IEnumerable<AFValues> listResults = attributeList.Data.InterpolatedValuesAtTimes( times, null, false, config); foreach (AFValues attributeResults in listResults) { // Map the results back to the attribute resultsMap[attributeResults.Attribute] = attributeResults; } } catch (OperationCanceledException) { // Errors that occur during bulk calls get trapped here // The actual error is stored on the PIPagingConfiguration object Console.WriteLine(config.Error.Message); } catch (Exception otherEx) { // Errors that occur in an iterative fallback method get trapped here Console.WriteLine(otherEx.Message); }
' Holds the results keyed on the associated attribute Dim resultsMap As New Dictionary(Of AFAttribute, AFValues) ' Results should be sent back for 100 tags in each page. Dim config As New PIPagingConfiguration(PIPageType.TagCount, 100) Try Dim listResults As IEnumerable(Of AFValues) = attributeList.Data.InterpolatedValuesAtTimes(times, Nothing, False, config) For Each attributeResults As AFValues In listResults ' Map the results back to the attribute resultsMap(attributeResults.Attribute) = attributeResults Next Catch canceledEx As OperationCanceledException ' Errors that occur during bulk calls get trapped here ' The actual error is stored on the PIPagingConfiguration object Console.WriteLine(config.Error.Message) Catch otherEx As Exception ' Errors that occur in an iterative fallback method get trapped here Console.WriteLine(otherEx.Message) End Try
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.