Question

I have got the following code in a button on a form, but I want to get the OID or ID value of the saved object so that I can load it directly later.

procedure TFormMain.ButtonNewClick(Sender: TObject);
var
  Employee: Variant;
  OId: Variant;
begin
  Employee := Factory.New('Sample.Employee', True);
  if VarIsNull(Employee) or VarIsClear(Employee) then
  begin
    ShowMessage('Could not create Employee!');
    Exit;
  end;

  Employee.Name := 'Foo Bar';
  Employee.SSN := '616-27-7814';

  Employee.Sys_Save;

  OId := Employee.Sys_getOID; <- This doesn't exist

  Employee.Sys_Close;
  Employee := NULL;
end;

The documention shows functions like GetId but they require you to pass in the OID, but I don't see a function for that, and just .OID etc. don't work, I have the feeling since all the tutorials show examples of loading by OID or ID that I am missing something pretty basic.

Any pointers would be very helpful.

Thanks, Bruce

Was it helpful?

Solution

Have you tried Employee.Oid or Employee.Sys_Oid?

OTHER TIPS

Reading the documentation for InterSystem Cache's ActiveX objects, I do not see any way to get an OID from a Sample.Employee object.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top