AFTable Class
- Last UpdatedNov 18, 2025
- 13 minute read
- PI System
- AF SDK 2024 R2
- Developer

Inheritance Hierarchy
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
| Name | Description | |
|---|---|---|
| AFTable |
Initializes a new instance of the class with default values.
| |
| AFTable(String) |
Initializes a new instance of the class with the specified name.
|
Properties
| Name | Description | |
|---|---|---|
| CacheInterval |
The table's cached data automatic refresh interval.
| |
| Categories |
This is a user-defined collection of categories for the object that can be used for
querying and/or reporting purposes.
| |
| CategoriesString |
This read-only property returns the list of categories in a string separated by semicolons.
| |
| CheckOutInfo |
This read-only property returns the checked out status information for the object.
| |
| ConvertToLocalTime |
Indicates if the time values within a table should be treated as client local time.
| |
| Database |
This read-only property returns the AFDatabase where this object is defined.
| |
| Description |
Read/write property that provides a more detailed description of the object.
| |
| ExternalCommand |
This property retrieves the command string used to load
externally linked tables.
| |
| ExternalConnection |
This property retrieves the connection string used to load
externally linked tables.
| |
| ExternalPersist |
This property indicates whether the table is persisted in an external
database.
| |
| ExternalType |
This property retrieves the type of connection to make to the
external database.
| |
| HasParameters |
This property indicates whether the query used to return data for
this AFTable has parameters.
| |
| 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.) | |
| Identity |
This read-only property contains identity of the object.
(Inherited from AFObject.) | |
| ImpersonateUser |
This property indicates whether the PI AF Server will impersonate
the client when retrieving an externally persisted table.
| |
| IsDeleted |
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.) | |
| IsDirty |
This read-only property indicates whether the object has been modified since the
last save to the PI AF Server.
| |
| IsNew |
This read-only property indicates whether the object is new and has never been saved
to the PI AF Server.
| |
| Name |
Read/write property that identifies the name of the object.
| |
| PISystem |
This read-only property allows access to the PISystem associated with this
object.
(Inherited from AFObject.) | |
| QueryDate |
This read-only property returns the date used to retrieve the version of an object.
| |
| Security |
This read-only property returns the AFSecurity information for the object.
| |
| Table |
This property provides access to the cached data of a table.
| |
| TableConnection |
This property retrieves or sets the AFTableConnection object
associated with externally linked tables.
| |
| TimeZone |
The AFTimeZone configured for the entire table.
| |
| UniqueID |
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.) | |
| Version |
This read-only property returns the current version information as an
AFVersion object.
|
Methods
| Name | Description | |
|---|---|---|
| ApplyChanges |
This method applies the changes to the object and makes
those changes available to other objects for the current user.
| |
| ApplyQueryDate |
Applies the specified query date to the current object and returns an object in the new context.
| |
| CheckIn |
This method checks in (commits) all the changes to the object by saving
the information to persistent storage.
| |
| CheckOut |
This method locks the object so that its configuration can be modified.
| |
| CheckOutTables |
Check out the objects with the specified unique identifiers at the specified query date.
| |
| CompareTo(Object) |
Compares this instance with a specified Object.
(Inherited from AFObject.) | |
| CompareTo(AFObject) |
Compares this instance with a specified AFObject.
(Inherited from AFObject.) | |
| DeleteTables |
Delete the objects with the specified unique identifiers.
| |
| Equals(Object) |
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.) | |
| Equals(AFObject) |
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.) | |
| FindTable(PISystem, Guid) |
Retrieves the AFTable object with the specified unique identifier
at the AFTime.MaxValue query date.
| |
| FindTable(PISystem, Guid, Guid) |
Retrieves the AFTable object with the specified unique identifier
and the specified version id.
| |
| FindTable(PISystem, Guid, Object) |
Retrieves the AFTable object with the specified
unique identifier at the specified query date.
| |
| FindTables(PISystem, Guid, Object) |
Performs a search within the PISystem to retrieve a collection
of AFTable objects with the specified list of unique identifiers.
| |
| 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.
| |
| GetDefaultTableParameters |
Retrieves any table parameters and default values used to retrieve data for this AFTable.
| |
| GetExtendedProperty |
Gets the extended property value of the table or a column of the table.
| |
| 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.) | |
| GetPath |
Returns the full path to the object, using just the names.
(Inherited from AFObject.) | |
| GetPath(AFObject) |
Returns the path to the object relative from another object.
(Inherited from AFObject.) | |
| 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.) | |
| GetSecurity |
Gets the AFSecurity information of the specified security item
associated with the object.
| |
| GetTableWithParameters |
Get cached data for the AFTable with the specified parameters.
| |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| InitializeDataTable | ||
| LinkExternal(IDbDataAdapter) | Obsolete.
This method allows the table to be linked to an external database.
| |
| LinkExternal(IDbDataAdapter, Boolean, SecureString) |
This method allows the table to be linked to an external source while protecting security.
| |
| 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.
| |
| 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.
| |
| LoadTables(IListAFTable) |
Loads the specified list AFTable objects.
| |
| LoadTables(PISystem, Guid, Object) |
Loads the AFTable objects with the specified unique identifiers at
the specified query date.
| |
| Persist |
This method returns the persistence string for the object.
(Inherited from AFObject.) | |
| Refresh |
Refreshes the client with any changes that have been made to the table since loaded.
| |
| RenameExtendedPropertyColumn |
Renames the column for all extended properties associated with the old column name.
| |
| SetExtendedProperty |
Sets the extended property value of the table or column of the table.
| |
| ToString |
Returns a String that represents the current object.
(Inherited from AFObject.) | |
| 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
| Name | Description | |
|---|---|---|
| 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.
| 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. |
| 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:- CacheInterval
- ConvertToLocalTime
- ExternalCommand
- ExternalConnection
- ExternalPersist
- ExternalType
- HasParameters
- ImpersonateUser
- Table
- TableConnection
| 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 Property | Description |
|---|---|
| Table | Demonstrates 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. |