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: 
Not applicable

Help to combine a if/else and loop in script

Hi

I can´t solve this if/else in script. My aim is to load a transactiontabel diffrent depending month(today())

IF Month(Today())=1 OR Month(Today())=2 then

FOR i = $(vMinYear) TO $(vMaxYear)

Let vStartDatum = Date#($(i) & '-01-01', 'YYYY-MM-DD');

Let vSlutDatum = Date#($(i) & '-12-31', 'YYYY-MM-DD');

Tabel:

Load

..

From ...

ELSE

FOR i = $(vYearToday) TO $(vMaxYear)

Let vStartDatum = Date#($(i) & '-01-01', 'YYYY-MM-DD');

Let vSlutDatum = Date#($(i) & '-12-31', 'YYYY-MM-DD');

Table:

Load

..

From ...

It the part For i = ... that doesn´t work with the if-statement.

3 Replies
anbu1984
Master III
Master III

Did you verify values of variables $(vMinYear) , $(vMaxYear) and $(vYearToday)?

Not applicable
Author

yes. the work fine. I´d change and use a switch case.

Not applicable
Author

NEXT is missing in IF control statement