Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

leonling
New Contributor II

How to drop all tables with exclusions.

I am currently performing a binary load on the governance dashboard and there are some unwanted tables that impact performance. The problem is that some tables in PROD governance don't exist in DEV or QA governance.

Is there a way to drop all tables except for a chosen few tables? I have tried the following:

Drop All Tables Except

but it doesn't drop all tables. It drops about half of the tables. The same goes for the following code:

SET vexemptList= 'SessionTaskAuditMaster Governance_AD_Link AD_USERS Profit_Centers PC_LOB';

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);

  ENDIF

NEXT

It only drops some and not all of the tables.

Is there a way to drop all tables with exclusions? Thank you.

Tags (1)
1 Solution

Accepted Solutions

Re: How to drop all tables with exclusions.

I could speculate, but the best way to debug this kind of problem is to look at the script log to see what's happening. If you can't figure out what the problem is from the log, please post the relevant portion of the log here.

BTW, when I do this kind of processing I usually walk the tables backwards, avoiding the changing index problem.

For vTableNo = vNoofTables-1 to 0 step -1  ;

vTableName = TableName(vTableNo) ;


-Rob

http://masterssummit.com

http://qlikviewcookbook.com

2 Replies

Re: How to drop all tables with exclusions.

I could speculate, but the best way to debug this kind of problem is to look at the script log to see what's happening. If you can't figure out what the problem is from the log, please post the relevant portion of the log here.

BTW, when I do this kind of processing I usually walk the tables backwards, avoiding the changing index problem.

For vTableNo = vNoofTables-1 to 0 step -1  ;

vTableName = TableName(vTableNo) ;


-Rob

http://masterssummit.com

http://qlikviewcookbook.com

leonling
New Contributor II

Re: How to drop all tables with exclusions.

Working the table backwards solved my problem, thank you!