I found it tricky when it comes to managing tables after Binary load.
Usually, you do it like this to create a new application like Region sales.qvw with Binary:
Binary [\\QLIKVIEW\Load\Sales.qvw];
DROP Tables PERMISSIONS, Clients, Dimensions, Expressions;
In most cases, there are a lot more tables to drop out.
While working on other projects you add additional tables to the Sales.qvw file. So you have to remember that there are some applications like Region sales.qvw where you have to drop the newly created table.
But instead, you can simply write down the tables you need and want to leave in the data model in Region sales.qvw.
Just create a new SUB in notepad like master_subs.txt:
SUB Leave_tables(tables)
For t = 0 to NoOfTables() - 1
Tables:
Load TableName($(t)) as TableName
,If(Index('$(tables)', TableName($(t))) > 0, 1, 0) as [Do we leave a table]
Autogenerate 1;
Next t;
tmp:
LOAD '[' & Concat(TableName, '], [') & '];' as table_names
Resident Tables
Where [Do we leave a table] = 0
;
DROP Table Tables;
v_drop_tables = Peek('table_names', 0, 'tmp');
DROP Table tmp;
DROP Table $(v_drop_tables);
END SUB
After that you have to edit your script to this:
Binary [\\QLIKVIEW\Load\Sales.qvw];
$(Include=\\QLIKVIEW\Data\Master\master_subs.txt);
CALL Leave_tables('Sales, Sales person');
In this case, you do not have to worry about the newly created tables in the Sales.qvw as those tables might cause some serious data model problems, increase the size of the Region sales.qvw app.