Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
monica_
Partner
Partner

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
Creator III
Creator III

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
MVP & Luminary
MVP & Luminary

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