Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
doplear01
Creator
Creator

if statetement with date have diferents output in qv12 vs qv11

 

I execute the abobe statement in QV12 and QV11 and i receive diferent values. Any thoughst? why C variable have different values?. The variable dateformat have the same setting in both. SET DateFormat='M/D/YYYY';

 

LET A = Today();
LET B = Today()+1;
LET C = IF(1=2,Today()+1,Today());

QV12

C 12/23/2019 2:08:40 PM
B 43823.589340278
A 12/23/2019 2:08:38 PM

 

QV11

C 43822.590185185
B 43823.590173611
A 12/23/2019 2:09:50 PM

 

 

 

 

Labels (1)
1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

It is indeed about how the expression has been evaluated.

Case 1: LET A = Today();

Here the Today() function returns a dual value - both a number and a string. The string corresponds to the formatted date, used for display. So the variable gets both a number a string.

Case 2: LET B = Today()+1;

The Today() function still returns a dual value, but since a number is added to the numeric value, the string representation is invalidated. So the formatted date is not carried over to the variable. In QlikView 11 all modifications of the date will invalidate the string returned by Today().

For QlikView 12 we have changed this slightly, since we realized that we do not need to be so strict.

Case 3: LET C = IF(1=2,Today()+1,Today());

In QV12, the If() function sometimes invalidates the string, sometimes not. In this case, it is invalidated for the 2nd parameter but not for the 3rd.

So, yes, QlikView 11 and QlikView 12 are slightly different here: QlikView 12 is smarter.

See also https://community.qlik.com/t5/Qlik-Design-Blog/Data-Types-in-QlikView/ba-p/1474977

HIC

View solution in original post

4 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

What i understand is, this difference is because of the way the expression is getting evaluated.

@hic  can help us more to understand this.

Regards,

Kaushik Solanki

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

Following Design Blog posts may be of some help:

https://community.qlik.com/t5/Qlik-Design-Blog/Why-don-t-my-dates-work/ba-p/1465849

https://community.qlik.com/t5/Qlik-Design-Blog/Get-the-Dates-Right/ba-p/1476178

Here is the base Design Blog link in case you want to search further on your own:

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

The two specific posts are both by Henric, just FYI.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
doplear01
Creator
Creator
Author

Is not a format issue the problem is the way the expression is getting evaluated. Notice that the if statement go to today() function in both cases and the result is diferent

hic
Former Employee
Former Employee

It is indeed about how the expression has been evaluated.

Case 1: LET A = Today();

Here the Today() function returns a dual value - both a number and a string. The string corresponds to the formatted date, used for display. So the variable gets both a number a string.

Case 2: LET B = Today()+1;

The Today() function still returns a dual value, but since a number is added to the numeric value, the string representation is invalidated. So the formatted date is not carried over to the variable. In QlikView 11 all modifications of the date will invalidate the string returned by Today().

For QlikView 12 we have changed this slightly, since we realized that we do not need to be so strict.

Case 3: LET C = IF(1=2,Today()+1,Today());

In QV12, the If() function sometimes invalidates the string, sometimes not. In this case, it is invalidated for the 2nd parameter but not for the 3rd.

So, yes, QlikView 11 and QlikView 12 are slightly different here: QlikView 12 is smarter.

See also https://community.qlik.com/t5/Qlik-Design-Blog/Data-Types-in-QlikView/ba-p/1474977

HIC