Getting the OID or ID of an object through ActiveX in Delphi from InterSystems Cache
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(Empl开发者_JS百科oyee) 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
Have you tried Employee.Oid
or Employee.Sys_Oid
?
Reading the documentation for InterSystem Cache's ActiveX objects, I do not see any way to get an OID from a Sample.Employee
object.
精彩评论