Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
pacoli2013
Creator
Creator

Drop aTable when a flag is zero

Hello,

I hope someone can help me, there are many files and tables in my document. So I have made an excelfile where the tables or filenames which I want to delete get the flag 0 (Zero).  I made a little script, it runs but the table is not deleted/dropped.

for Testing I have one table in my excelfile with flag 0 called SalesInvoice,

/*

Load ExcelFile DropTablesFields

if Flag = 0 then Drop Table

*/

DropTables:
LOAD
A  as TableName,
B  as Flag
FROM

(ooxml, no labels, header is 1 lines, table is Tabelle1);
// where = 0;
IF = 0 THEN
   Set vTableName = A;
   DROP Table $( vTableName);
     DROP TABLE A;
ENDIF

Perhaps someone can tell where my thinking went wrong.

I'm also open for a control if the table I want to drop, exists in my document.

Regards,

Court

2 Replies
sunny_talwar

Maye be like this:

DropTables:

LOAD

A  as TableName,

B  as Flag

FROM

(ooxml, no labels, header is 1 lines, table is Tabelle1)

Where B = 0;

For i = 0 to FieldValueCount(TableName)

    LET TableName = FieldValue('TableName', $(i));

      DROP Table $(TableName);

NEXT i

pacoli2013
Creator
Creator
Author

Thanks for your reply,

I will test it tomorrow