Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
sivarajs
Specialist II
Specialist II

store into qvd

Hi,

I am using for loop in my script and am storing into qvd based on iterations

But qvd have only one value because of overwriting

Is there any way to avoid overwriting

sivaraj s

4 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi Sivaraj,

In for loop you Concatenate into a table instead of storing it into QVD file, finally store the table after looping into QVD.

Hope this helps you.

Regards,

Jagan.

Sokkorn
Master
Master

Hi Sivaraj,

This is just an idea and sample for you

FOR i = 0 to $(vNoOfRows)-1

    LET vTable = PEEK('Tablename', $(i), 'TableList');

    LOAD * RESIDENT [$(vTable)];

    STORE [$(vTable)] INTO $(vQVDPath)$(vTable).qvd;

    DROP TABLE [$(vTable)];

NEXT i

Can you share your scrip?

Regards,

Sokkorn

Miguel_Angel_Baeyens

Hi,

Yes, but you will need to do either a double load or save into different files. Double load should look like this (note that I have not tested it and you may need to check the code)

For i=1 To 10

     // Here is the original data

     Table:

     LOAD *

     FROM File.qvd (qvd);

     // Here you are pulling new data

     CONCATENATE (Table) LOAD *;

     SQL SELECT *

     FROM NewData;

     // Now the same file has both old and new data

     STORE Table INTO File.qvd (qvd);

     DROP TABLE Table;

Next

The other option (because LOAD allows the use of wildcards):

For i=1 To 10

     Table:

     LOAD *;

     SQL SELECT *

     FROM NewData;

     // This will create Table_1.qvd, Table_2.qvd, Table_3.qvd and so on

     STORE Table INTO Table_$(i).qvd (qvd);

     DROP TABLE Table;

Next

AllData:

LOAD *

FROM Table_*.qvd (qvd);

Hope that helps.

Miguel


sivarajs
Specialist II
Specialist II
Author

@miguel i have tried by storing into seperate qvds. The problem is i have more parameters and qvds genearte based on parameters also more

@sokkorn n @miguel  am using script like

for i=1 to 5

let var1=fieldvalue('custID',$(i));

Tmp1:

load category,count(caseid) as caseid_count

from hpd.qvd where custID='$(var1)' group by category;

tmp2:

first 5 load caseid_count,category

resident Tmp1;

drop table Tmp1;

tmp3:

load stdev(caseid_count) as cat_std

resident tmp2;

drop table tmp2;

reg1:

load region,count(caseid) as caseid_count

from hpd.qvd where custID='$(var1)' group by region;

reg2:

first 5 load caseid_count,region

resident reg1;

drop table reg1;

reg3:

load stdev(caseid_count) as cat_std

resident reg2;

drop table reg2;

cons:// trying to store red highlighted table into qvd

load * ,'' as i

resident tmp3;

drop table tmp3;

drop field i;

join

load * ,'' as i

resident reg3;

drop table reg3;

drop field i;

store cons into cons.qvd(qvd);

next