Article Satoshi Hosoi · Jul 27, 2023 1m read

How to determine if the value of a local variable is OREF

InterSystems FAQ rubric

Whether the value of a local variable is an OREF or not can be determined using $IsObject(). Let v be the variable you want to check,

$IsObject(v)=1// v is an OREF$IsObject(v)=0// v is not an OREF$IsObject(v)=-1// v is an OREF but does not point to a valid object

Note that $IsObject(v) will give an UNDEFINED error if v is undefined.

To avoid UNDEFINED errors, it is recommended to use $Get like this:

$IsObject($Get(v))