Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
monica_
Partner - Contributor
Partner - Contributor

Do While Loop inside load table

A client asked me if it's possible implementing a do while loop inside a load table to build a new field but I don't think it's possible. Also I don't think it's possible implementing a for loop.

For example:

NoConcatenate
TABLE_2:
LOAD
field1,

field2, 

filed3,.....


Do while a <10
   define code with field1, field2, filed3
loop

RESIDENT TABLE_1;

3 Replies
stevejoyce
Specialist II
Specialist II

a do while loop is possible:

Example:

// LOAD files file1.csv..file9.csv

Set a=1;

Do while a<10

LOAD * from file$(a).csv;

Let a=a+1;

Loop

 

Do..loop ‒ QlikView

 

marcus_sommer

In general it's possible to create inside-load-loops, for example with something like:

t: load F1, F2, ... from x while iterno() < 10;

It depends on what you really want to do by "define code ..." if it's possible and sensible or if there are more suitable approaches possible.

- Marcus

Nadi_Clarke
Contributor II
Contributor II

LET a = 'field1';

            tab1:

           LOAD

          field1

           from some_file.qvd;

Let b = ',field';

SET i=2;

Do while i < 10

LET a = $(a) & $(b) $(i); /* create a set with fields*/

 

noconcatenate

tab_$(i)

LOAD

$(a)

from some_file.qvd;

LET i = i+1

LOOP