Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see Why Migrate to InterSystems IRIS?

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.

See Also

Feedback