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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
luke1986
Contributor III
Contributor III

Loop inside a Load

Hello,

Iam trying to Loop inside a Load until it has reached a specific number.

Because i have a table with a lot of Columns (Artikel.L1 --> Artikel.L20)

So basically this is what i have tried,

for i=1 to 20

LOAD

Key&'-'&Artikel.L$(i) as Artikel$(i)

Resident FullTree;

Next i;

It generate seperate Tables for every step.

but i want them in one single Table. How do i achieve this?

Thanks for your help!

Labels (1)
1 Solution

Accepted Solutions
pokassov
Specialist
Specialist

for i=1 to 20

if i=1 then

table1:

LOAD

Key&'-'&Artikel.L$(i) as Artikel$(i)

Resident FullTree;

else

concatenate (table1)

LOAD

Key&'-'&Artikel.L$(i) as Artikel$(i)

Resident FullTree;

end if;

Next i;

View solution in original post

4 Replies
swuehl
Champion III
Champion III

for i=1 to 20

IF i > 1 THEN

CONCATENATE

ENDIF

LOAD

Key&'-'&Artikel.L$(i) as Artikel$(i)

Resident FullTree;

Next i;

pokassov
Specialist
Specialist

for i=1 to 20

if i=1 then

table1:

LOAD

Key&'-'&Artikel.L$(i) as Artikel$(i)

Resident FullTree;

else

concatenate (table1)

LOAD

Key&'-'&Artikel.L$(i) as Artikel$(i)

Resident FullTree;

end if;

Next i;

alexandros17
Partner - Champion III
Partner - Champion III

solution 1:

MyTab:

Select '' as fld1 .... '' as fldn;

For i=1 to 20

concatenate (MyTab)

Load ....

next

solution 2:

For i=1 to 20

myTab_$(i)

Load ....

next

For i=1 to 20

load ... resident myTab_$(i);

next

let me know

luke1986
Contributor III
Contributor III
Author

Thanks Sergey,

It worked!