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

AVEVA Enterprise SCADA High Performance Database (HPDB) API Reference

Retrieve the enumeration of a field

This scenario guides you through the steps required to retrieve a collection of all the enumeration fields of an analog record in the RealTime database (RTDB).

To identify the code associated with each step, see the code comments in the Example code section.

To retrieve a collection of all enumeration fields

  1. Open the Program.cs file from the created project.
  2. Open the RTDB.
  3. Access the analog table.
  4. Get the enumerations collection.

Example code

IRealTimeDatabase database = new RealTimeDatabase();
try
{
    // Open the RTDB.
    if (!database.IsOpen())
    {
        database.Open();
    }
   
    // Access the analog table.
    using (IRealTimeTable table = new RealTimeTable("analog"))
    {   
        // Get the enumerations collection.                
        IRealTimeEnumType rtEnumType = new RealTimeEnumType("hilowstate");
       
        foreach (var rtEnumInfo in rtEnumType.GetRealTimeEnumInfoCollection())
        {
            Console.WriteLine(
quot;
{rtEnumInfo.Name} {rtEnumInfo.Value}"); } } } catch (Exception ex) { Console.WriteLine(
quot;Error getting the enumerator collection:
{ex.Message}"); }
TitleResults for “How to create a CRG?”Also Available in