Other inquiry functions (such as Is Matrix(), Is List(), Is Scriptable(), and so on) let you test for specific types of objects. In the following example, Is Matrix() evaluates as true, then the specified calculations are run:
If( Is Matrix( c ),
Is Scriptable() returns 1 when the object is scriptable. Four variables in the following example refer to a data table, column, platform, and report. All four objects are scriptable, so Is Scriptable() returns 1 for each example.
plat = Bivariate( Y( :weight ), X( :height ) );
rep = Report( plat );
Show( Is Scriptable( dt ) );
Show( Is Scriptable( col ) );
Show( Is Scriptable( plat ) );
Show( Is Scriptable( rep ) );
Is Empty() tests to see whether a variable has a value, a function, an expression, or a reference to an object. It returns 1 if the variable is undefined or holds the Empty() value.Otherwise, you get errors when referring to something that has not been created or assigned a value yet. Programmers call this an uninitialized variable.
Here is an example of a test to see whether a data table is opened and therefore assigned to the dt variable. If a data table is not opened, the Open() function prompts the user to open the table.
You can use Is Empty() for any variable (such as global variable, local variable, and columns).
Inquiry Functions That Identify Object Types shows functions that identify object types.
Is Empty(global)
Is Empty(dt)
Is Empty(col)
|
|
Is Expr(x)
|
|
Is List(x)
|
|
Is Name(x)
|
|
Type(x)
|