Qlik Community

Ask a Question

QlikView Documents

QlikView documentation and resources.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY

Storing all tables in Qlikview file to QVD

jagan
Luminary Alumni
Luminary Alumni

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!

0 Likes
surajap123
Creator II
Creator II

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

0 Likes
jagan
Luminary Alumni
Luminary Alumni

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
Creator
Creator

Excellent code, Jagan. This is very helpful

0 Likes
rakesh_kumar
Creator
Creator

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?

0 Likes
jagan
Luminary Alumni
Luminary Alumni

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
Specialist
Specialist

Too good code Jagan.....

0 Likes
sanjyotpatkar
Creator III
Creator III

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?

0 Likes
sanjyotpatkar
Creator III
Creator III

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

0 Likes
arifcit520
Explorer II
Explorer II

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

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