Function

IsUndefined

Action


Given a table as a parameter, this built-in function will output a table that indicates whether the input table is real and full of values or whether it is the result of an operation that produced nothing, which is different to producing an empty table.


Parameters

Table (table) The table to analyze.

Return values

A table with a single row and a single column called Value which will be set to one of the following:


ValueMeaning
1The input table was undefined (no columns or rows)
0The input table was defined (has columns at least)


Example

An instruction that generates and tests for an undefined table. The reason it is undefined is because the body of the foreach is never executed. The script output is column Value with a cell containing the number one.

@sequence = Utilities.GenerateSequence(Limit: 5);
@emptyTable = SELECT * FROM @sequence WHERE Sequence = 1942;
@undefinedTable = FOREACH @number IN @emptyTable DO
    SELECT * FROM @number WHERE Sequence > 3;
DONE;
@isUndefined = IsUndefined( Table : @undefinedTable );
SELECT * FROM @isUndefined;

An instruction that generates and tests for an defined table. The script output is column Value with a cell containing the number zero.

@sequence = Utilities.GenerateSequence(Limit: 5);
@definedTable = FOREACH @number IN @sequence DO
    SELECT * FROM @number WHERE Sequence > 3;
DONE;
@isUndefined = IsUndefined( Table : @definedTable );
SELECT * FROM @isUndefined;


Platforms
  • All
Notes

Only works for @tables not $tables.