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

AF SDK Reference

AFTable.GetExtendedProperty Method

  • Last UpdatedNov 18, 2025
  • 5 minute read
AFTable.GetExtendedProperty Method
Gets the extended property value of the table or a column of the table.

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

Syntax

public Object GetExtendedProperty(
	string colName,
	string propName
)
Public Function GetExtendedProperty ( 
	colName As String,
	propName As String
) As Object

Dim instance As AFTable
Dim colName As String
Dim propName As String
Dim returnValue As Object

returnValue = instance.GetExtendedProperty(colName, 
	propName)
public:
Object^ GetExtendedProperty(
	String^ colName, 
	String^ propName
)
member GetExtendedProperty : 
        colName : string * 
        propName : string -> Object 

Parameters

colName
Type: SystemString
The name of the table's column whose extended property is to be retrieved. If or an empty string, then the extended property of the table is retrieved.
propName
Type: SystemString
The name of the extended property to be retrieved.

Return Value

Type: Object
Returns the value of the specified extended property. If the table has not been defined, the specified column does not exist, or the property does not exist, then is returned.

Remarks

This method can be used to retrieve custom information for the table or a column of the table. For more information, see SetExtendedProperty(String, String, Object).

Examples

// This example demonstrates how to import a table using an ADO.NET DataTable to create an
// internal table. It also demonstrates setting and getting the extended properties of an AFTable.

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

// Create a small Table using an ADO.NET DataTable
DataTable dtMyTable = new DataTable();
dtMyTable.Locale = CultureInfo.CurrentCulture;
AFTable myTable = myDB.Tables.Add("myTable");
myTable.TimeZone = AFTimeZone.UtcTimeZone;
myTable.Description = "This is my table.";

dtMyTable.Columns.Add("TankName", typeof(System.String));
dtMyTable.Columns.Add("Height", typeof(System.Double));
dtMyTable.Columns.Add("Volume", typeof(System.Double));
dtMyTable.Columns.Add("Date", typeof(System.DateTime));
AFTable.InitializeDataTable(myTable, dtMyTable);

DataRow drMyRow0 = dtMyTable.NewRow();
drMyRow0["TankName"] = "TK101";
drMyRow0["Height"] = 0;
drMyRow0["Volume"] = 0;
drMyRow0["Date"] = DateTime.UtcNow;

DataRow drMyRow1 = dtMyTable.NewRow();
drMyRow1["TankName"] = "TK101";
drMyRow1["Height"] = 1;
drMyRow1["Volume"] = 12.4;
drMyRow1["Date"] = DateTime.UtcNow.AddDays(-1);

DataRow drMyRow2 = dtMyTable.NewRow();
drMyRow2["TankName"] = "TK101";
drMyRow2["Height"] = 2;
drMyRow2["Volume"] = 48.6;
drMyRow2["Date"] = DateTime.UtcNow.AddDays(-2);

dtMyTable.Rows.Add(drMyRow0);
dtMyTable.Rows.Add(drMyRow1);
dtMyTable.Rows.Add(drMyRow2);
dtMyTable.AcceptChanges();

// Set the Table and CachInterval Properties
// and Set the UOM for Volume
myTable.Table = dtMyTable;
myTable.CacheInterval = TimeSpan.FromMinutes(10);
myTable.SetExtendedProperty("Volume", "UOM", "US gal");
myTable.CheckIn();

// Display the table name and description
Console.WriteLine("Table Name = {0}", myTable.Name);
Console.WriteLine("Description = {0}", myTable.Description);
Console.WriteLine();

// Get the UOM for Volume
string uomName = myTable.GetExtendedProperty("Volume", "UOM") as string;
if (!String.IsNullOrEmpty(uomName))
{
    Console.WriteLine("UOM Property = {0}", uomName);
    Console.WriteLine();
}

// Display the DataTable
foreach (DataRow row in myTable.Table.Rows)
{
    Console.WriteLine("Tank Name = {0}", row["TankName"]);
    Console.WriteLine("  Height = {0}", row["Height"]);
    Console.WriteLine("  Volume = {0}", row["Volume"]);
    Console.WriteLine("  Date   = {0}", row["Date"]);
}

// The Table can be Refreshed Manually using AFTable.Refresh
myTable.Refresh();
' This example demonstrates how to import a table using an ADO.NET DataTable to create an
' internal table. It also demonstrates setting and getting the extended properties of an AFTable.

' Get the Database
Dim myPISystems As New PISystems
Dim myDB As AFDatabase = myPISystems.DefaultPISystem.Databases.DefaultDatabase

' Create a small Table using an ADO.NET DataTable
Dim dtMyTable As New DataTable()
dtMyTable.Locale = CultureInfo.CurrentCulture
Dim myTable As AFTable = myDB.Tables.Add("myTable")
myTable.TimeZone = AFTimeZone.UtcTimeZone
myTable.Description = "This is my table."

dtMyTable.Columns.Add("TankName", GetType(String))
dtMyTable.Columns.Add("Height", GetType(Double))
dtMyTable.Columns.Add("Volume", GetType(Double))
dtMyTable.Columns.Add("Date", GetType(DateTime))

Dim drMyRow0 As DataRow = dtMyTable.NewRow()
drMyRow0.Item("TankName") = "TK101"
drMyRow0.Item("Height") = 0.0#
drMyRow0.Item("Volume") = 0.0#
drMyRow0.Item("Date") = DateTime.UtcNow

Dim drMyRow1 As DataRow = dtMyTable.NewRow()
drMyRow1.Item("TankName") = "TK101"
drMyRow1.Item("Height") = 1.0#
drMyRow1.Item("Volume") = 12.4
drMyRow1.Item("Date") = DateTime.UtcNow.AddDays(-1)

Dim drMyRow2 As DataRow = dtMyTable.NewRow()
drMyRow2.Item("TankName") = "TK101"
drMyRow2.Item("Height") = 2.0#
drMyRow2.Item("Volume") = 48.6
drMyRow2.Item("Date") = DateTime.UtcNow.AddDays(-2)

dtMyTable.Rows.Add(drMyRow0)
dtMyTable.Rows.Add(drMyRow1)
dtMyTable.Rows.Add(drMyRow2)
dtMyTable.AcceptChanges()

' Set the Table and CachInterval Properties
' and Set the UOM for Volume
myTable.Table = dtMyTable
myTable.CacheInterval = TimeSpan.FromMinutes(10)
myTable.SetExtendedProperty("Volume", "UOM", "US gal")
myTable.CheckIn()

' Display the table name and description
Console.WriteLine("Table Name = {0}", myTable.Name)
Console.WriteLine("Description = {0}", myTable.Description)
Console.WriteLine()

' Get the UOM for Volume
Dim uomName As String = TryCast(myTable.GetExtendedProperty("Volume", "UOM"), String)
If Not String.IsNullOrEmpty(uomName) Then
    Console.WriteLine("UOM Property = {0}", uomName)
    Console.WriteLine()
End If

' Display the DataTable
For Each row As DataRow In myTable.Table.Rows
    Console.WriteLine("Tank Name = {0}", row("TankName"))
    Console.WriteLine("  Height = {0}", row("Height"))
    Console.WriteLine("  Volume = {0}", row("Volume"))
    Console.WriteLine("  Date   = {0}", row("Date"))
Next

' The Table can be Refreshed Manually using AFTable.Refresh
myTable.Refresh()

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.

Version Information

AFSDK


See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in