Question
Vladimir Prushk... · Feb 21, 2017

Parse %ObjectIdentity

Hi!

I'm trying to implement %OnAfterDelete ClassMethod for persistent class. As a parameter it gets oid As %ObjectIdentity for the deleted object.

ClassMethod %OnAfterDelete(oid As %ObjectIdentity) As %Status

My question is: how to get ID value from %ObjectIdentity ?

0
0 411
Discussion (2)1
Log in or sign up to continue

the format of an Object Id is $LISTBUILD(id,class) so when I delete a row from Sample.Person I get:

SAMPLES>zw oid
oid=$lb("4","Sample.Person")

The Id is the first $List element:

SAMPLES>w $LISTGET(oid,1)
4

%occOID.inc defines macros to use for work with oid:

set id = $$$oidPrimary(oid)
set class = $$$oidClassName(oid)
set global = $$$oidSysAd1(oid) // streams only
set oid = $$$idCurrent //get current object oid