This might sound a bit wierd. I am looking to drop all tables from the file.
I thought "drop table *;" should do it. but it doesn't.
Can anyone please let me know if there is quick to do this?
Any help will be appreciated.
try the script below.
FOR i=1 to vAnz
DROP TABLE $(vTab);
If thats works, please verify and reply, if not please also give me feedback so we could solve your issue.
There must be a way to do it with a loop through all tables, but I'm not sure exactly how to set it up.
Edit: Whoops. Two people posted solutions while I was trying to figure it out. Never mind!
Vlad and Michael,
Thanks for your time. you both are almost on the same lines.
and yes both of your scripts do work.
Actually I already had something similar to that... was looking if we had a direct way to do this.
Anyways... Thanks again...
In the following :
let numTables = NoOfTables();
for i=1 to $(numTables)
let tt = TableName(0);
drop table [$(tt)];
NoOfTables() returns 0 when a qlikview document is opened only and not reloaded.
Is there a way to get the actual number of tables in qlikview document when it is just opened and not reloaded and open.
Just to add to the topic:
If you need to retain any Tables you can use following code
//Don't use ',' it will confuse index function. I used a space as a seperator
SET vexemptList='Table1 Table2 Table3 ';
LET vNoofTables = NoOfTables();
For vTableNo = 0 to vNoofTables-1 ;
//When one table get deleted the next in line get that number.So always delete first table in the list.
//For example if there is 4 tables and loop already finished 2 times there will not be any value for TableName(3)
vTableName = TableName(0) ;
Let vIndex = Index('$(vexemptList)','$(vTableName)') ;
If $(vIndex)=0 then
DROP Table $(vTableName);