Example: Joining Two Records

This example demonstrates the join between two records. This join can be done by creating a view also.

In this example, the plug-in retrieves the objects from the PSLOCK and PSVERSION tables where versions of the objects don’t match.

import PT_DIAGNOSTICS:*;

class MatchVersions extends PT_DIAGNOSTICS:PTDiagnostics
   /* Constructor */
   method MatchVersions();
   /* Public Method */
   method GetDiagnosticInfo();
   method IsPlugIn();
private
end-class;

method MatchVersions;
   Local boolean &status = False;
   %Super = create PT_DIAGNOSTICS:PTDiagnostics();
   &status = %Super.SetProperty(%This, "Purpose", "String", "This is to retrieve
 the objects whose versions doesnot match in PSLOCK and PSVERSIONS.");
end-method;

method GetDiagnosticInfo
   Local boolean &status;
   Local Rowset &rs1;
   Local Rowset &rs2;
   Local integer &i, &j;
   Local Row &ro1;
   &rs1 = CreateRowset(Record.PSVERSION);
   &rs1.Fill();
   &rs2 = CreateRowset(Record.PSLOCK);
   &rs2.Fill();
   For &i = 1 To &rs1.RowCount
      For &j = 1 To &rs2.RowCount
         If (&rs1.GetRow(&i).GetRecord(Record.PSVERSION).OBJECTTYPENAME.Value =
 &rs2.GetRow(&j).GetRecord(Record.PSLOCK).OBJECTTYPENAME.Value) And
               (&rs1.GetRow(&i).GetRecord(Record.PSVERSION).VERSION.Value <>
 &rs2.GetRow(&j).GetRecord(Record.PSLOCK).VERSION.Value) Then
            &status = %Super.InsertData("String", "OBJECTTYPENAME: ", &rs1.GetRow
(&i).GetRecord(Record.PSVERSION).OBJECTTYPENAME.Value | " PSVERSION.VERSION: "
 | &rs1.GetRow(&i).GetRecord(Record.PSVERSION).VERSION.Value | " PSLOCK.VERSION: "
 | &rs2.GetRow(&j).GetRecord(Record.PSLOCK).VERSION.Value);
         End-If;
      End-For;
   End-For;
end-method;

method IsPlugIn
end-method;