Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have to concatenate 3 tables with the same fields.
I could do this in this way.
Table 1
field 1
field 2
....
field n
FROM TABLE 1
Table 2
field 1
field 2
....
field n
FROM TABLE 2
Table 3
field 1
field 2
....
field n
FROM TABLE 3
But i'd like to try to use the for . something like this
for table 1 to table 3
field 1
field 2
....
field n
FROM TABLE 1,2,3
how i do this?
thank you
This should work
LET vConcatenate = '';
LET vNoTables = 3;
For i =1 to $(vNoTables)
LET vTable = 'Table' & $(i);
Table:
$(vConcatenate)
LOAD yourFields
FROM $(vTable);
LET vConcatenate = 'Concatenate';
Next;
Best,
Sunny
if the tables have the same number and name of fields
Qlik will autoconcatenate
table1: load 1 as a, 2 as b autogenerate 10;
table2: NoConcatenate load 1 as a, 2 as b autogenerate 10;
table3: NoConcatenate load 1 as a, 2 as b autogenerate 10;
for i=1 to 3
table: load *, 'new' as newfield resident table$(i);
next;
DROP table table1, table2, table3;
DROP Field newfield;