Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section

IsObject

Returns a value indicating whether an expression references a valid Automation object.

Synopsis

IsObject(expression)

Arguments

The expression argument can be any kind of expression (such as a numeric or string expression).

Description

Expression Evaluates To IsObject Returns
valid Object Reference 1
invalid Object Reference –1
not an Object Reference 0

IsObject returns a –1 value if expression is a reference to an invalid object. Invalid objects should not occur in normal operations; an invalid object could be caused, for example, by recompiling the class while instances of the class are active.

Examples

The following example uses the IsObject function to determine if an identifier represents an object variable:

o = New Sample.Person
Println IsObject(o)        ' Returns 1.
Println IsObject("hello")  ' Returns 0.
o = ""
Println IsObject(o)        ' Returns 0.
Copy code to clipboard

See Also