Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Could anyone explain how for loop works with simple example?
Thanks & Regards
For loop - Wikipedia, the free encyclopedia
Are you asking about for loop or for each loop to load data from multiple file ?
I need explanation for both "for and for each"
We use the For loop every file is sequentially loaded from the source folder and then
a preceding load is applied.
Syntax:
For each vFile in FileList
('lib://QlikSenseCookBookForEachLoadData/*.xlsx')
CountrySales:
LOAD *,Left(Source,3) as Month;
Load
Country,
Sales,
Filebasename() as Source
from [$(vFile)]
(ooxml, embedded labels, table is Sheet1);
Next vFile
Another example is:
TABLE:
load * inline
[A, B, C
China, Cotton, Shirt
India, Cotton, Socks
Japan, Leather, Jacket];
let vNOR=NoOfRows('TABLE');
for i=1 to $(vNOR)
let vA=FieldValue('A',$(i));
let vB=FieldValue('B',$(i));
let vC=FieldValue('C',$(i));
NEXT;