Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Save $600 on Qlik Connect registration! Sign up by Dec. 6 to get an extra $100 off with code CYBERSAVE: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can anyone figure out why this isn't working?

Hi all,

I have the attached script which I'm using to try and create a temporary calendar table that simply holds dates from my vMinDate to my vMaxDate. For some reason the table isn't loading properly and the only result I get is one entry stating '30/12/1899'!

Can anyone see anything glaringly obvious from the code that I'm missing as I can't seem to figure this one out?!

Any help is appreciated,

Thanks,

Samuel


1 Solution

Accepted Solutions
tresesco
MVP
MVP

Redefine your variables like:

let vMaxDate= Num(MakeDate(2020, 12, 31));

let vMinDate= Num(MakeDate(2015, 1, 1));

To explain why that is not working:

'31/12/2020' - is actually being expanded (because of $) and generating a number

31 divided by 12 divided by 2020 ->0.0012...       //      '/' is being considered as numeric operator

And if you apply date(0.0012)- you get the first that of qv calendar system : '30/12/1899'

View solution in original post

8 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Dates format is unrecognized, try with

'2020/12/31' and '2015/01/01'

Not applicable
Author

Unfortunately this isn't correcting the issue, I'm rather stumped by this!

Anonymous
Not applicable
Author

what is your dateformat? can you create a texstobject with (date(today()).

Use this Format for your calendar

Ralf-Narfeldt
Employee
Employee

You  have some data format variables at the beginning of the script, does it say this or something else?

SET DateFormat='MM/DD/YYYY';

tresesco
MVP
MVP

Redefine your variables like:

let vMaxDate= Num(MakeDate(2020, 12, 31));

let vMinDate= Num(MakeDate(2015, 1, 1));

To explain why that is not working:

'31/12/2020' - is actually being expanded (because of $) and generating a number

31 divided by 12 divided by 2020 ->0.0012...       //      '/' is being considered as numeric operator

And if you apply date(0.0012)- you get the first that of qv calendar system : '30/12/1899'

simenkg
Specialist
Specialist

the variables needs to be numbers, not strings.

let vMaxDate = Floor(Date#('31/12/2020','DD/MM/YYYY'))

let vMinDate = Floor(Date#('01/01/2015','DD/MM/YYYY'));

or just use

let vMaxDate = Floor(MakeDate(2020,12,31));

let vMinDate = Floor(MakeDate(2015,01,01));

sunny_talwar

Try this may be:

LET vMaxDate = Date#('31/12/2020', 'DD/MM/YYYY')

LET vMINDate = Date#('01/01/2015', 'DD/MM/YYYY')

Not applicable
Author

Just like to take the opportunity to thank everyone who's contributed, I can only mark a few questions though so please don't get offended if it isn't yours.