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 RealTimeSetRecord from a RealTimeRecord using the RealTimeRecord pointer

Create a RealTimeSetRecord from a RealTimeRecord using the RealTimeRecord pointer

This scenario guides you through the steps required to create a RealTimeSetRecord object from a RealTimeRecord.

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

To create a RealTimeSetRecord

  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 name.
  5. Lock the analog record for reading.
  6. Get the record pointer.
  7. Create the RealTimeSetRecord object.
  8. Unlock the analog record.
  9. 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.
        var nameField = new RealTimeStringField(table, "name");
        using (var record = table.FindRecord(nameField, "AutoCommandAnalog01"))
        {
            // Lock the analog record for read.
            record.Lock(recordLockRequest.SAFE_READ);
            // Get the record pointer.
            var recPointer = record.HPDBRealTimeRecord.RecordPointer;
            using (var setRecord = new RealTimeSetRecord((RealTimeSetTable)table.GetRealTimeSetTable(), recPointer))
            {                           
                // User code that uses the set record object
                var desc = setRecord.ReadField<String>("description");
                Console.WriteLine(
quot;Description:
{desc}"); } } // Leaving scope releases the analog record lock. } // Leaving scope releases the analog table lock. } catch (Exception ex) { Console.WriteLine(
quot;Error getting the RealTimeSetRecord:
{ex.Message}"); }
TitleResults for “How to create a CRG?”Also Available in