Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

For...next goes beyond high limit

Dear All, I'm trying to create a table o records being single days out of given periods. To do so, I'm using for...next loop but get stuck with defining "TO" value in the counter. The script looks like below:

SQL SELECT StartDate, EndDate FROM db1.

LET B = EndDate - StartDate

FOR i=0 TO '$(B)'

StartDate + '(i)' AS Day

FROM db1

When I put marks to B i.e. B = 'EndDate - StartDate' the script starts off but goes beyond the high limit. Could you please help with the code?

BR, Przemek

1 Reply
hector
Specialist
Specialist

Hi, try this script change

SQL SELECT StartDate, EndDate FROM db1.

LET B = num(EndDate - StartDate); //just in case 😉

FOR i=0 TO $(B)

Load //why you don't have a load statement if you have a From??

StartDate + $(i) AS Day

FROM db1 //where is the select/load of this from??

you can use the trace $(B), and with the option "Generate Log File" in "Document Properties", you will see the B value

rgds