Click or drag to resize
OSIsoft, LLC

AFData Class

The AFData object is associated with a single AFAttribute and is used to retrieve and set extended historical data. It is accessed through the Data property of an AFAttribute.

Inheritance Hierarchy
SystemObject
  OSIsoft.AF.DataAFData

Namespace:  OSIsoft.AF.Data
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 2.10.5.9050
Syntax
public class AFData

The AFData type exposes the following members.

Properties
  NameDescription
Public propertyAttribute
The AFAttribute associated with this object.
Public propertyStatic memberBufferOption
Indicates the AFBufferOption to use when updating values.
Public propertyCacheEnabled
Whether AFDataCache is enabled for this AFData instance.
Public propertyCacheStartTime
The earliest event time stamp in the AFDataCache for this AFData instance.
Public propertyEventsCached
The number of events cached for this AFData instance.
Top
Methods
  NameDescription
Public methodCreateWithInputDataProvider
Creates a new AFData instance that will evaluate this attribute with input data obtained by the specified input data provider.
Public methodEndOfStream
Returns the end-of-stream AFValue.
Public methodEndOfStreamAsync
Get the value with the largest timestamp for a data stream.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodFilteredSummaries
This method, when supplied a filter expression that evaluates to true or false, evaluates it over the passed time range. For the time ranges where the expression evaluates to true, the method calculates the requested summaries on the source attribute.
Public methodFilteredSummariesAsync
This method, when supplied a filter expression that evaluates to true or false, evaluates it over the passed time range. For the time ranges where the expression evaluates to true, the method calculates the requested summaries on the source attribute.
Public methodGetAllCachedValues
Get all the events in the AFDataCache for this AFData instance.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInterpolatedValue
Returns a single AFValue whose value is interpolated at the passed time.
Public methodInterpolatedValueAsync
Returns a single AFValue whose value is interpolated at the passed time.
Public methodInterpolatedValues
Retrieves interpolated values over the specified time range at the specified sampling interval.
Public methodInterpolatedValuesAsync
Retrieves interpolated values over the specified time range at the specified sampling interval.
Public methodInterpolatedValuesAtTimes
Retrieves interpolated values at the specified times.
Public methodInterpolatedValuesAtTimesAsync
Retrieves interpolated values at the specified times.
Public methodPlotValues
Retrieves values over the specified time range suitable for plotting over the number of intervals (typically represents pixels).
Public methodPlotValuesAsync
Retrieves values over the specified time range suitable for plotting over the number of intervals (typically represents pixels).
Public methodRecordedValue
Returns a single recorded AFValue based on the passed time and mode.
Public methodRecordedValueAsync
Returns a single recorded AFValue based on the passed time and mode.
Public methodRecordedValues
Returns a list of compressed values for the requested time range from the source provider.
Public methodRecordedValuesAsync
Returns a list of values for the requested time range from the source provider.
Public methodRecordedValuesAtTimes
Retrieves recorded values at the specified times.
Public methodRecordedValuesAtTimesAsync
Retrieves recorded values at the specified times.
Public methodRecordedValuesByCount
This method returns a specified number of compressed values beginning at the requested start time in the direction specified.
Public methodRecordedValuesByCountAsync
This method returns a specified number of compressed values beginning at the requested start time in the direction specified.
Public methodReplaceValues(AFTimeRange, AFValues)
This method removes existing data within the specified AFTimeRange and inserts the specified values on the target system using the configured data reference.
Public methodReplaceValues(AFTimeRange, AFValues, AFBufferOption)
This method removes existing data within the specified AFTimeRange and inserts the specified values on the target system using the configured data reference.
Public methodReplaceValuesAsync(AFTimeRange, AFValues, CancellationToken)
This method removes existing data within the specified AFTimeRange and inserts the specified values on the target system using the configured data reference.
Public methodReplaceValuesAsync(AFTimeRange, AFValues, AFBufferOption, CancellationToken)
This method removes existing data within the specified AFTimeRange and inserts the specified values on the target system using the configured data reference.
Public methodSummaries
Returns several summaries for a single attribute over a time range for each interval within the range.
Public methodSummariesAsync
Returns several summaries for a single attribute over a time range for each interval within the range.
Public methodSummary
Returns several summaries for a single attribute over a single time range.
Public methodSummaryAsync
Returns several summaries for a single attribute over a single time range.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUpdateValue(AFValue, AFUpdateOption)
This method writes, replaces, or removes a value on the target system using the configured data reference.
Public methodUpdateValue(AFValue, AFUpdateOption, AFBufferOption)
This method writes, replaces, or removes a value on the target system using the configured data reference.
Public methodUpdateValues(AFValues, AFUpdateOption)
This method writes or replaces one or more values on the target system using the configured data reference.
Public methodCode exampleUpdateValues(AFValues, AFUpdateOption, AFBufferOption)
This method writes or replaces one or more values on the target system using the configured data reference.
Public methodUpdateValuesAsync(AFValues, AFUpdateOption, CancellationToken)
This method writes or replaces one or more values on the target system using the configured data reference.
Public methodUpdateValuesAsync(AFValues, AFUpdateOption, AFBufferOption, CancellationToken)
This method writes or replaces one or more values on the target system using the configured data reference.
Top
Remarks

The AFData object is created on demand when accessed via the Data property of the AFAttribute. If the attribute will be repeatedly queried, this object should be cached. If retrieving data for multiple attributes, use the AFListData class retrieved from the Data.

The AFAttribute.SupportedDataMethods and AFDataReference.SupportedDataMethods properties can be checked to see if a data method is supported.

Note Notes to Callers
This method, property, or class is only available in the .NET 4 version of the SDK.

Examples
// This example demonstrates how to create an attribute for an
// element and retrieve values using the 'Data' object.

// Get the Database
PISystems myPISystems = new PISystems();
PISystem myPISystem = myPISystems.DefaultPISystem;
AFDatabase myDB = myPISystem.Databases.DefaultDatabase;

// Create an Element
AFElement myElement = myDB.Elements.Add("MyElement");

// Create an Attribute
AFAttribute myAttribute = myElement.Attributes.Add("MyAttribute");
myAttribute.DefaultUOM = myPISystem.UOMDatabase.UOMs["kelvin"];
myAttribute.DataReferencePlugIn = AFDataReference.GetPIPointDataReference(myPISystem);
myAttribute.ConfigString = @"\\%Server%\sinusoid";

// Get the Recorded Value for the Attribute
AFTime myTime = DateTime.Now.AddDays(-1);
AFValue value = myAttribute.Data.RecordedValue(myTime, AFRetrievalMode.AtOrBefore, myAttribute.DefaultUOM);
Console.WriteLine("Value = '{0}' at '{1}'", value, myTime);
Version Information

AFSDK

Supported in: 2.10.5, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6, 2.5
See Also
Enabling Operational Intelligence