
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
