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

Create a record

This scenario guides you through the steps required to create 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 create a record

  1. Open the Program.cs file from the created project.
  2. Open the RTDB.
  3. Access the analog table.
  4. Lock the analog record for writing.
  5. Create the record.
    Where:
    • "Name" field is "AnalogPoint_1" (key field) 
    • "Description" field is "Description of AnalogPoint_1"
  6. Unlock the analog record.

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"))
    {     
        // Lock the analog record for writing.
        IRecordLockRequestType recordLockRequest = new RecordLockRequestType();
        // Create the record.
        using (IRealTimeRecord record = table.CreateRecord("AnalogPoint_1"))
        {
            record.Lock(recordLockRequest.SAFE_WRITE);
            record.WriteField<String>("description", "AnalogPoint_1 description");
        } // Leaving scope releases the analog record lock.
    }
}
catch (Exception ex)
{
    Console.WriteLine(
quot;Error creating a record:
{ex.Message}"); }
TitleResults for “How to create a CRG?”Also Available in