Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Master III
Master III

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

Highlighted
Not applicable

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

Highlighted
Not applicable

NEXT is missing in IF control statement