Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

subathra
New Contributor II

Need help to execute for loop

Hi all,

I have two tables

Table1:

Sitecode
3
4

Table2:

SitecodeValue
315
310
420
430

My Desired Output:

load Table2 where sitecode is 3 and store it in april_3.qvd

load Table2 where sitecode is 4 and store it in april_4.qvd

Error i am getting:

in april_3.qvd i get datas where sitecode is 3

but in april_4.qvd i get both sitecode 3,4(here i need only sitecode 4)

my script is:

SheetName1:

LOAD

    Sitecode

FROM [lib://data/test22.xlsx]

(ooxml, embedded labels, table is Sheet1);

for iSheet = 0 to NoOfRows('SheetName1') - 1

               let vSheetName1 = peek('Sitecode',iSheet, 'SheetName1');

Final:

LOAD

    Sitecode,

    Name,

    Value

FROM [lib://data/test.xlsx]

(ooxml, embedded labels, table is Sheet1) where Sitecode='$(vSheetName1)';

Store Final into [lib://data/april_$(vSheetName1).qvd] (qvd);

Next iSheet

drop table SheetName1;

1 Solution

Accepted Solutions
tomasz_tru
Valued Contributor

Re: Need help to execute for loop

Maybe this would help:

Subroutines in load script

3 Replies
tomasz_tru
Valued Contributor

Re: Need help to execute for loop

Maybe this would help:

Subroutines in load script

subathra
New Contributor II

Re: Need help to execute for loop

thanks Tomasz

subathra
New Contributor II

Re: Need help to execute for loop

Is there any other solutionns