Qlik Community

QlikView Documents

Documents for QlikView related information.

Storing all tables in Qlikview file to QVD

MVP
MVP

Storing all tables in Qlikview file to QVD

Hi All,

The below script helps in creating the qvds for each table in the datamodel of a Qlikview file.

FOR vCount = 0 to NoOfTables()-1

     LET vTableName = TableName($(vCount));

     STORE $(vTableName) INTO $(vTableName).qvd (qvd);

NEXT vCount

Refer this thread for more details

Reload QlikView Application (QVW) File Without Access To Data Source(s)

Regards,

Jagan.

Comments
Not applicable

Just what I needed! Spitze!

surajap123
Contributor II

Thanks for the script. I am wondering how to use it. Could you please provide a sample app.

MVP
MVP

Hi Suraj,

If you have a qlikview file and you want to save all the tables into QVDs then try like this

Create a new file and binary load the QVW which you want to create QVDs and use below script

Binary FileName.qvw;

FOR vCount = 0 to NoOfTables()-1

     LET vTableName = TableName($(vCount));

     STORE $(vTableName) INTO $(vTableName).qvd (qvd);

NEXT vCount

Hope this helps you.

Regards,

Jagan.

rakesh_kumar
Contributor

Excellent code, Jagan. This is very helpful

rakesh_kumar
Contributor

Jagan, is it possible to add additional code to the above code block to restrict the number rows in each QVD to just 100 rows?

MVP
MVP

Try something like this

FOR vCount = 0 to NoOfTables()-1

     LET vTableName = TableName($(vCount));

     Temp:

     Noconcatenate

     First 100 LOAD

     *

     RESIDENT  $(vTableName)

     STORE Temp INTO $(vTableName).qvd (qvd);

     DROP TABLE Temp;

NEXT vCount

mayankraoka
Valued Contributor

Too good code Jagan.....

sanjyotpatkar
Contributor II

Hi Jagan

I have a similar reqts but I am reading data from spreadsheets and I have listed the names in an inline table below.

SET DATA_FilePath='C:\Users\43862460\Desktop\Incremental Load\';

ILES:
load * Inline [
FileName
Echannels
MEHIE
]
;

for i  = 1 to FieldValueCount('FileName')

let lastexectime  =  num(date(ReloadTime(),'MM/DD/YYYY hh:mm:ss TT'));
let BeginningThisExectime  =  num(date(now(),'MM/DD/YYYY hh:mm:ss TT'));

let vFileName  =  FieldValue('FileName',$(i));

$(vFileName):
load
*

FROM
[$(DATA_FilePath)$(vFileName).xlsx]
(
ooxml, embedded labels) where ([Modified Date] >= '$(lastexectime)' and [Modified Date] < '$(BeginningThisExectime)' ) ;

STORE $(vFileName) into [$(DATA_FilePath)$(vFileName).qvd](qvd);

next i;

drop Table FILES;

This script run fine when there is a single File name and generates qvd.

The moment I add a second file name to it it says unable to store the second qvd in the given path. The first qvd gets created successfully but I am getting an error while creating the second qvd.

Will you be able to suggest what is going wrong?

sanjyotpatkar
Contributor II

when I used noconcatenate before the load statement it worked fine..I am still not able to understand why it worked with noconcatenate

arifcit520
Visitor

Why this storing only the last table value? Is it because QVD file only store single table value?



FOR vCount = 0 to NoOfTables()-1


     LET vTableName = TableName($(vCount));


     STORE $(vTableName) INTO 'lib://Assignment01/ALL.qvd' (qvd);


//      STORE $(vTableName) INTO 'lib://Assignment01/$(vTableName).qvd' (qvd);


NEXT vCount

Version history
Revision #:
1 of 1
Last update:
‎06-24-2014 10:05 PM
Updated by: