IsValid PowerScript function
Description
Determines whether an object variable is instantiated—whether
its value is a valid object handle.
Syntax
|
1 |
<span>IsValid</span> ( <span>objectvariable</span> <span></span>) |
|
Argument |
Description |
|---|---|
|
objectvariable |
An object variable or a variable of type Any—typically |
Return Values
Boolean. Returns true if objectvariable is
an instantiated object. Returns false if objectvariable is
not an object, or if it is an object that is not instantiated. If objectvariable is null, IsValid returns null.
Usage
Use IsValid instead of the Handle function
to determine whether a window is open.
Examples
This statement determines whether the window w_emp is
open and if it is not, opens it:
|
1 |
IF <span>IsValid</span>(w_emp) = FALSE THEN Open(w_emp) |
This example returns -1 because the IsValid function
returns false. Although the objectvariable argument
is a valid string, it is not an instantiated object. The IsValid method
would return true only if la_value was
an instantiated object:
|
1 |
any la_value |
|
1 |
|
1 |
la_value = "I'm a string" |
|
1 |
IF NOT <span>IsValid</span>(la_value) THEN return -1 |