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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
subathra
Partner - Contributor III
Partner - Contributor III

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

3 Replies
tomasz_tru
Specialist
Specialist

Maybe this would help:

Subroutines in load script

subathra
Partner - Contributor III
Partner - Contributor III
Author

thanks Tomasz

subathra
Partner - Contributor III
Partner - Contributor III
Author

Is there any other solutionns