Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
dineshraj
Not applicable

How for loop works?

Hi all,

Could anyone explain how for loop works with simple example?

Thanks & Regards

5 Replies
Gysbert_Wassenaar
Not applicable

Re: How for loop works?

For loop - Wikipedia, the free encyclopedia


talk is cheap, supply exceeds demand
VishalWaghole
Not applicable

Re: How for loop works?

Loops in the Script

Hope it will help you.

Regards,

Vishal Waghole

ramkrishna86
Not applicable

Re: How for loop works?

Are you asking about for loop or for each loop to load data from multiple file ?

dineshraj
Not applicable

Re: How for loop works?

I need explanation for both "for and for each"

ramkrishna86
Not applicable

Re: How for loop works?

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
;