Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
chriys1337
Creator III
Creator III

For each loop does not work

Hi,

I am not sure where my mistake is, but QV script runs through but does not generate the table:

LET vL.Week=20;

For i = right(WeekName(today()),2) to $(vL.Week) // FOR 16 to 20
Selection_Table:
Load
left(WeekName(today()),4) & right(WeekName(today()),2) +IterNo() 
as Selection;
next i

1 Solution

Accepted Solutions
Anonymous
Not applicable

try:

LET vL.Week=20;

For i = right(WeekName(today()),2) to $(vL.Week) // FOR 16 to 20
Selection_Table:
Load
left(WeekName(today()),4) & right(WeekName(today()),2) +$(i)
as Selection AutoGenerate 1;
next i

View solution in original post

4 Replies
Anonymous
Not applicable

where's your reference table?

or do you use autogenerate?

did you try an explicit noconcatenate?

Anonymous
Not applicable

try:

LET vL.Week=20;

For i = right(WeekName(today()),2) to $(vL.Week) // FOR 16 to 20
Selection_Table:
Load
left(WeekName(today()),4) & right(WeekName(today()),2) +$(i)
as Selection AutoGenerate 1;
next i

chriys1337
Creator III
Creator III
Author

This worked fine, it was the missing reference table. Also it is working with autogenerate, thank you!

SET vL.FutureWeek=right(WeekName(today()),2)+6;

For i = right(WeekName(today()),2) to $(vL.FutureWeek)
Selection_Table:
Load
left(WeekName(today()),4) & (right(WeekName(today()),2)+rowno()-1)
as Selection
AutoGenerate 1 ;
next i

Anonymous
Not applicable

yes, you can't do a load on nothing...

... and iterno() only works for LOAD <-> while loops...