Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Basic for...next loop in script, but can't make it to work

Hi everyone. I'm Christian, a Qlik newbie, and this is my first question

I have several days in a qvd file, have no problems to obtain maximun and minimun dates, and number of days between that dates

What I want to do is a loop that goes from 0 to that number of days. But I'm making something wrong. The loop always exits because of the 'if' condition rather than 'for' condition.

What I'm doing worng? Thanks in advance

cotas:

LOAD

min(Date(Floor(FechaAlta))) as minimo,

max(Date(Floor(FechaAlta))) as maximo,

max(Date(Floor(FechaAlta)))-min(Date(Floor(FechaAlta))) as dias

Resident carga;

LET vDiasInFile = 'dias';

LET vPasesInFile = 0;

for vI = 0 to '$(vDiasInFile)'

vPasesInFile = vPasesInFile + 1;

IF vI >= 10 then

EXIT For;

ENDIF

NEXT vI

1 Solution

Accepted Solutions
sunny_talwar

Try this:

LET vDiasInFile = Peek('dias');

View solution in original post

3 Replies
sunny_talwar

Try this:

LET vDiasInFile = Peek('dias');

Anonymous
Not applicable
Author

Tks sunny, will try and let you know!

Anonymous
Not applicable
Author

It works. Tanks!!!