Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Check if a table is already loaded

Hi,

    I would like to check if a table exist before dropping this table. I used this function

          if noOfRows('mytable')>0 then

          drop table mytable; 

          endif

   However, later i found that if a table has been created but contains no data. noOfRows function also return a number which is less or equals to zero. The scenario is as below:

mytable:

load *

from mytable;

inner join

load * from

anothertable;

The above scenario creates mytable and makes it empty by a inner join.

This causes my table not being dropped. Could anyone tell me if there is another way of checking the existence of a table?

1 Solution

Accepted Solutions
Not applicable
Author

Hi in case anybody facing the same problem. I've already found a solution. I check the output of noOfRows('table') under debug. If a table does not exist, it returns null, else it returns the number of rows in a table. So in order to check whether a table exists of not. We should use

if noOfRows('table') <>null then

...

endif

View solution in original post

3 Replies
Not applicable
Author

Hi in case anybody facing the same problem. I've already found a solution. I check the output of noOfRows('table') under debug. If a table does not exist, it returns null, else it returns the number of rows in a table. So in order to check whether a table exists of not. We should use

if noOfRows('table') <>null then

...

endif

Not applicable
Author

Thanks! Very thoughtful of you to give everyone your solution.

Arek92
Contributor III
Contributor III

After 12 years still it does the trick. Thank you unknown OP