Retrieve field information for a RealTime table filtered by field kind
- Last UpdatedApr 08, 2026
- 2 minute read
This scenario guides you through the steps required to retrieve field information for a RealTime database (RTDB) table, filtered by field kind.
To identify the code associated with each step, see the code comments in the Example code section.
Before you begin
- Review the list of additional namespaces needed for this scenario.
using System; using OASySDNA.RealTime.Data.Common.HighPerformanceDBWrapper; using OASySDNA.RealTime.Data.Common.HighPerformanceDBWrapper.Interfaces; using OASySDNA.RealTime.Data.Common.HighPerformanceSetDBWrapper.Interfaces; using OASySDNA.RealTime.HighPerformanceSetDB;
To retrieve the field information of a RealTime table filtered by field kind
- Open the Program.cs file from the created project.
- Open the RTDB.
- Get the table RealTime type.
- Filter by RealTimeFieldKinds.
RealTimeFieldKinds enumeration represents the kinds of RTDB table fields.
This enumeration may be combined using bitwise logical AND/OR operators to generate a filter criteria bit mask to pass into the GetRealTimeFieldInfoCollection() method, returning only the results that match the filter.
- RTTYPE_STRUCT: RealTime struct type.
- RTTYPE_STRING: RealTime string type.
- RTTYPE_ENUM: RealTime enum type.
- RTTYPE_ARRAY: RealTime array type.
- RTTYPE_SLOT: RealTime slot type.
- RTTYPE_PRIMITIVE: RealTime primitive type.
- RTTYPE_PSEUDO: RealTime pseudonym type.
- RTTYPE_KEYS: RealTime keys type.
- RTTYPE_ALL: RealTime all type.
- Get the RealTime fieldInfoCollection.
- For each field, process the field collection results by doing the following:
- Get fieldInfo properties.
Example code
IRealTimeDatabase database = new RealTimeDatabase();
try
{
// Open the RTDB.
if (!database.IsOpen())
{
database.Open();
}
using (IRealTimeTable table = new RealTimeTable("analog"))
{
// Get the table RealTime type.
IRealTimeStructType tableType = table.GetRecordRealTimeType();
// Filter by RealTimeFieldKinds
RealTimeFieldKinds fieldKinds = RealTimeFieldKinds.RTTYPE_STRING | RealTimeFieldKinds.RTTYPE_SLOT;
// Get the RealTime fieldInfoCollection
var fieldInfoCollection = tableType.GetRealTimeFieldInfoCollection(fieldKinds);
// Process field collection results.
foreach (var fieldInfo in fieldInfoCollection)
{
var isKeyString = fieldInfo.Key ? "a key" : "not a key ";
// Get Field Info properties
Console.WriteLine(quot;Field {fieldInfo.Name} is {isKeyString}");
}
}
}
catch (Exception ex)
{
Console.WriteLine(quot;An error occurred while getting all the fields: {ex.Message}.");
}