Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
riyazasma1009
Creator
Creator

Issue in generating dates

Hi,

I have written a simple script wherein I am generating dates.

LOAD Date;
LOAD Date(($(vStartDate) + RecNo()),'MM/DD/YYYY') as Date
AutoGenerate vEndDate - vStartDate;

After running the script, the Date field contains values from 12/31/1899 to 12/29/1900.

However, I wish to generate all the dates between 1/1/2017 to 12/31/2017. Can someone please help me as to where I am going wrong.

Thanks,

Asma

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi convert them to number.

Let vStartDate = num(makedate(2017,1,1,));

Let vEndDate = num(makedate(2017,12,31));

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

6 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Make sure that the vStartDate variable has got the correct date in number format.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Anonymous
Not applicable

Hey, could you show what vStartdate contains?

May be it is problem with the format of your variable

riyazasma1009
Creator
Creator
Author

I have created start date and end date variables s:

LET vStartDate = MakeDate(2017,1,1);
LET vEndDate = MakeDate(2017,12,31);

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi convert them to number.

Let vStartDate = num(makedate(2017,1,1,));

Let vEndDate = num(makedate(2017,12,31));

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
riyazasma1009
Creator
Creator
Author

Thanks Kaushik for the solution!

riyazasma1009
Creator
Creator
Author

Can someone please as to why the below code returns only value 01/01/2017 in Date field.

LOAD Date,
Month(Date) as Month,
Year(Date) as Year;
LOAD Date($(vStartDate) + RowNo(),'DD/MM/YYYY') as Date
AutoGenerate vEndDate - vStartDate;