I have a function called table_exists. You pass it a table name as a string and it returns true if the table exists, false if not. I recently decided to update it by checking if the input argument was even bound to anything, but it doesn't like it.
For example:
isempty(xyz)
Returns a 1 in the log, meaning that xyz isn't bound to anything. But if I try
table_exists(xyz)
I get this error message:
ERROR: Name Unresolved: xyz in access or evaluation of 'xyz' , xyz
Here's the function:
table_exists = Function( {table_name},
{Default Local},
tbl_exists_flag = 0;
if (!isempty(table_name),
// Loop over all tables and see if this one exists
num_tables = ntable();
For (i = 1, i <= num_tables, i++,
one_name = Data Table(i) << Get Name;
if (one_name == table_name,
tbl_exists_flag = 1;
break(); // jump out of the loop now that we found the table
);
);
);
tbl_exists_flag;
);