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

AF SDK Reference

AFTable Class

  • Last UpdatedNov 18, 2025
  • 13 minute read
AFTable Class
The table object allows access to traditional relational database data through ADO.NET Data Tables.

Inheritance Hierarchy

SystemObject
  OSIsoft.AFAFObject
    OSIsoft.AF.AssetAFTable

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

Syntax

[SerializableAttribute]
public sealed class AFTable : AFObject, 
	IAFTransactable, IAFChangedEvent, IAFSecurable, IAFVersionable, IComparable<AFTable>
<SerializableAttribute>
Public NotInheritable Class AFTable
	Inherits AFObject
	Implements IAFTransactable, IAFChangedEvent, IAFSecurable, IAFVersionable, 
	IComparable(Of AFTable)

Dim instance As AFTable
[SerializableAttribute]
public ref class AFTable sealed : public AFObject, 
	IAFTransactable, IAFChangedEvent, IAFSecurable, IAFVersionable, IComparable<AFTable^>
[<SealedAttribute>]
[<SerializableAttribute>]
type AFTable =  
    class
        inherit AFObject
        interface IAFTransactable
        interface IAFChangedEvent
        interface IAFSecurable
        interface IAFVersionable
        interface IComparable<AFTable>
    end

The AFTable type exposes the following members.

Constructors

  NameDescription
Public method
AFTable
Initializes a new instance of the class with default values.
Public method
AFTable(String)
Initializes a new instance of the class with the specified name.

Properties

  NameDescription
Public property
CacheInterval
The table's cached data automatic refresh interval.
Public property
Categories
This is a user-defined collection of categories for the object that can be used for querying and/or reporting purposes.
Public property
CategoriesString
This read-only property returns the list of categories in a string separated by semicolons.
Public property
CheckOutInfo
This read-only property returns the checked out status information for the object.
Public property
ConvertToLocalTime
Indicates if the time values within a table should be treated as client local time.
Public property
Database
This read-only property returns the AFDatabase where this object is defined.
Public property
Description
Read/write property that provides a more detailed description of the object.
Public property
ExternalCommand
This property retrieves the command string used to load externally linked tables.
Public property
ExternalConnection
This property retrieves the connection string used to load externally linked tables.
Public property
ExternalPersist
This property indicates whether the table is persisted in an external database.
Public property
ExternalType
This property retrieves the type of connection to make to the external database.
Public property
HasParameters
This property indicates whether the query used to return data for this AFTable has parameters.
Public property
ID
Read-only property that provides a unique identifier for the object to be used for quick access that is not dependent upon the index.
(Inherited from AFObject.)
Public property
Identity
This read-only property contains identity of the object.
(Inherited from AFObject.)
Public property
ImpersonateUser
This property indicates whether the PI AF Server will impersonate the client when retrieving an externally persisted table.
Public property
IsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public property
IsDirty
This read-only property indicates whether the object has been modified since the last save to the PI AF Server.
Public property
IsNew
This read-only property indicates whether the object is new and has never been saved to the PI AF Server.
Public property
Name
Read/write property that identifies the name of the object.
Public property
PISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public property
QueryDate
This read-only property returns the date used to retrieve the version of an object.
Public property
Security
This read-only property returns the AFSecurity information for the object.
Public propertyCode example
Table
This property provides access to the cached data of a table.
Public property
TableConnection
This property retrieves or sets the AFTableConnection object associated with externally linked tables.
Public property
TimeZone
The AFTimeZone configured for the entire table.
Public property
UniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)
Public property
Version
This read-only property returns the current version information as an AFVersion object.

Methods

  NameDescription
Public methodCode example
ApplyChanges
This method applies the changes to the object and makes those changes available to other objects for the current user.
Public method
ApplyQueryDate
Applies the specified query date to the current object and returns an object in the new context.
Public methodCode example
CheckIn
This method checks in (commits) all the changes to the object by saving the information to persistent storage.
Public method
CheckOut
This method locks the object so that its configuration can be modified.
Public methodStatic member
CheckOutTables
Check out the objects with the specified unique identifiers at the specified query date.
Public method
CompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFObject.)
Public method
CompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public methodStatic member
DeleteTables
Delete the objects with the specified unique identifiers.
Public method
Equals(Object)
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.)
Public method
Equals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public methodStatic member
FindTable(PISystem, Guid)
Retrieves the AFTable object with the specified unique identifier at the AFTime.MaxValue query date.
Public methodStatic member
FindTable(PISystem, Guid, Guid)
Retrieves the AFTable object with the specified unique identifier and the specified version id.
Public methodStatic member
FindTable(PISystem, Guid, Object)
Retrieves the AFTable object with the specified unique identifier at the specified query date.
Public methodStatic member
FindTables(PISystem, Guid, Object)
Performs a search within the PISystem to retrieve a collection of AFTable objects with the specified list of unique identifiers.
Public methodStatic member
FindTables(AFDatabase, String, AFSearchField, AFSortField, AFSortOrder, Int32)
Performs a non-paged text search within the AFDatabase to retrieve a collection of AFTable objects which have a field that match the specified query string.
Public method
GetDefaultTableParameters
Retrieves any table parameters and default values used to retrieve data for this AFTable.
Public methodCode example
GetExtendedProperty
Gets the extended property value of the table or a column of the table.
Public method
GetHashCode
Gets the hash code for this instance of the object which is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from AFObject.)
Public method
GetPath
Returns the full path to the object, using just the names.
(Inherited from AFObject.)
Public method
GetPath(AFObject)
Returns the path to the object relative from another object.
(Inherited from AFObject.)
Public method
GetPath(AFEncodeType, AFObject)
Returns the path to the object relative from another object, using the name and/or id as specified by encodeType.
(Inherited from AFObject.)
Public method
GetSecurity
Gets the AFSecurity information of the specified security item associated with the object.
Public methodCode example
GetTableWithParameters
Get cached data for the AFTable with the specified parameters.
Public method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic member
InitializeDataTable
Helper method to initialize a DataTable to be used to set the Table property of the AFTable.
Public method
LinkExternal(IDbDataAdapter) Obsolete.
This method allows the table to be linked to an external database.
Public methodCode example
LinkExternal(IDbDataAdapter, Boolean, SecureString)
This method allows the table to be linked to an external source while protecting security.
Public methodCode example
LinkExternal(AFTableConnection, String, IDictionaryString, Object)
This method allows the table to be linked to an external source using a AFTableConnection and specifying default table parameters.
Public methodCode example
LinkExternal(IDbDataAdapter, Boolean, SecureString, IDictionaryString, Object)
This method allows the table to be linked to an external source while protecting security and specifying default table parameters.
Public methodStatic member
LoadTables(IListAFTable)
Loads the specified list AFTable objects.
Public methodStatic member
LoadTables(PISystem, Guid, Object)
Loads the AFTable objects with the specified unique identifiers at the specified query date.
Public method
Persist
This method returns the persistence string for the object.
(Inherited from AFObject.)
Public method
Refresh
Refreshes the client with any changes that have been made to the table since loaded.
Public method
RenameExtendedPropertyColumn
Renames the column for all extended properties associated with the old column name.
Public methodCode example
SetExtendedProperty
Sets the extended property value of the table or column of the table.
Public method
ToString
Returns a String that represents the current object.
(Inherited from AFObject.)
Public method
UndoCheckOut
This method discards all the changes to the object and all sub-objects since the last call to CheckOut. Any changes since the check out will be lost.

Events

  NameDescription
Public eventCode example
Changed
Event is raised when the object or one of its sub-objects is changed.

Remarks

The data in the table may be stored within the PI Asset Database (an internal table), or can be a link to an external table or query. When linking to an external table, an AFTableConnection should be used to isolate the table connection configuration from the querying of data for the table. Parameters within the query can also be used when linking to external tables to only return a portion of the data in the external table. See DataTable for more information about defining tables and LinkExternal Overload for more information about linking to external tables.

The contents of the table can be manually refreshed by calling the Refresh method. For internal tables, this will retrieve updates that other AF SDK users have stored into the internal table. For external tables, Refresh will re-retrieve the data from the linked table. By setting the CacheInterval property, the table contents will be automatically refreshed on the next access after the interval has expired. Refresh does not re-import internal tables. To update an imported table from its original source, the calling application must read the data into a DataTable and set the AFTable.Table property again.

There are several table related features that only supported on some servers. Use the PISystem.Supports method to check if the PISystem supports the ExternallyLinkedTable, the ExternallyLinkedTableWithSecurity, the ExternallyLinkedTableWithNonImpersonatedUser, the TableTimeColumn, the TableConnection, and/or the TableParameters features.

Security note Security Note
If the table is externally linked and the ImpersonateUser property is , then the user must have Admin permission on the PISystem to modify the AFTable's link.

Important note Important
When modifying the table's schema (e.g. adding a column or changing a column name), you must first call CheckOut to check out the object and ensure you are modifying the latest copy of the table. When finished, call AFTable.Table.AcceptChanges to commit the schema changes. Changes to the table schema cannot be automatically detected like changes to other properties.

A table implements the IAFVersionable interface which supports creating versions. The following properties and collections are common across all versions of the object:

The following properties and collections are specific to a version of the object:

Caution note Caution
Using object versions can be expensive in memory usage and performance. Extra memory is required to store the versions in the server and for each version of the object loaded in the client. Performance is degraded because of the extra data to be searched in the server and returned back to the client.

Examples

For examples showing how to configure and use an AFTable see the examples in the following methods or properties:

Method or PropertyDescription
TableDemonstrates how to import a table to create an internal table.
LinkExternal(IDbDataAdapter, Boolean, SecureString)Demonstrates how to link to an external table.
LinkExternal(AFTableConnection, String, IDictionaryString, Object)Demonstrates how to link to an external table using a table connection.
GetTableWithParameters(IDictionaryString, Object)Demonstrates how to read a table by specifying query parameters.
GetExtendedProperty(String, String)Demonstrates how to set and get an extended property on the table.

Version Information

AFSDK


See Also

TitleResults for “How to create a CRG?”Also Available in