At times we come across Qlik Sense applications for which we do not have the underlying data, using which the dashboard has been developed. And we want to extract some or all the data tables from that application to be used for other use cases or dashboards.
In such a case, create a table object for each of the tables and extract the data manually into excel. This approach works well when there are small numbers of tables available in the Qlik Sense data model. But, for a large number of tables, this approach may be tedious and error-prone.
Enter the For..Next loop to generate a QVD file for each table within the data model.
First, create a new Qlik Sense application and write a binary load statement as shown below.
For Qlik Sense Desktop you can try this.
Or for the Qlik Sense server, you can use this.
After this write below script to refer to each table in data model and store it as QVD.
/* First, we will get the numbers of tables available in data model */
Let vNumTables = NoOfTables();
/* NoOfTables() functions will return the total available tables in Qlik Sense Data Model and result will be stored in a variable named vNumTables */
/* Now we need to run the loop for each available table so that we can store it in QVD. We will start the loop from 0 to total numbers of table minus 1 because the first table name has the number 0 and next is 1 and so on. */
FOR i = 0 to NoOfTables() -1
/* Get the name of the table using TableName() Function. */
Let vTable = TableName(i);
/* Store the table into QVD. Make sure you change the library path to the path where you want to store all the QVD files*/
store ‘$(vTable)’ into [Lib://QVDs/$(vTable).qvd];
/* Once you store the table into QVD, you may not need it in this application, so you can use the Drop table statement to drop that table */
Drop table ‘$(vTable)’;
/* Next statement will run the next loop */
About The Author
Kaushik is a Qlik Luminary and Qlik MVP. Kaushik has co-authored two books on Qlik Sense i.e. “Implementing Qlik Sense” and “Hands on Business Intelligence with Qlik Sense”. Kaushik is passionate about solving business problems using business intelligence.