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 a record pointer

This scenario guides you through the steps required to retrieve a record pointer. A pointer to the record allows direct access to the memory for that record.

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

To retrieve a record pointer

When performing this procedure, ensure that the locks applied match the desired task (that is, if the record is locked for reading, do not write to the memory at the record pointer).

Any changes to a record using the record pointer will not be tracked via Management of Change (MoC) since you are directly modifying shared memory.

  1. Open the Program.cs file from the created project.
  2. Open the RealTime database (RTDB).
  3. Lock the analog table for reading.
  4. Find the analog record to get its pointer by name.
  5. Lock the analog record for reading.
  6. Get the record pointer.
  7. Unlock the analog record.
  8. Unlock the analog table.

Example code

IRealTimeDatabase database = new RealTimeDatabase();
try
{
    // Open the RTDB.
    if (!database.IsOpen())
    {
        database.Open();
    }
    using (IRealTimeTable table = new RealTimeTable("analog"))
    {
        ITableLockRequestType tableLockRequest = new TableLockRequestType();
        IRecordLockRequestType recordLockRequest = new RecordLockRequestType();
        // Lock the analog table for reading.
        table.Lock(tableLockRequest.SAFE_READ);
        // Find the analog record to get its pointer by name.
        var nameField = new RealTimeStringField(table, "name");
        using (var record = table.FindRecord(nameField, "AutoCommandAnalog01"))
        {
            // Lock the analog record for reading.
            record.Lock(recordLockRequest.SAFE_READ);
            // Get the record pointer.
            var recordPointer = record.HPDBRealTimeRecord.RecordPointer;                       
                       
            // User code that uses the record pointer.
        } // Leaving scope releases the analog record lock.
    } // Leaving scope releases the analog table lock.
}
catch (Exception ex)
{
    Console.WriteLine(
quot;Error getting the record pointer:
{ex.Message}"); }
TitleResults for “How to create a CRG?”Also Available in