Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
JeanJordaan
Contributor II
Contributor II

Possible bug ? Changing field name changes format

I get a date in a strange format.

1YYMMDD, One would assume that the following will work fine. 

Date(Date#(right(datefield,6),'YYMMDD')) as [DateField Check],
Result : 2021/01/27

This worked fine and gave the results as expected. A date value in the format as specefied in the main sheet.  However now that I have tested this and it is working I wanted to change the name to the correct one, so all I did was alter the code to be the following 

Date(Date#(right(datefield,6),'YYMMDD')) as [DateField],
Result : 44557


Now it changes from a date format to a number ?? 

I have also tried to specify the date format by using 
Date(Date#(right(datefield,6),'YYMMDD'),'YYYY/MM/DD') as [DateField],
Still the same error.

What could be causing this. 

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

Most likely it is caused by the usage of a field called [DateField] earlier in the script. When this field is loaded, its symbol tables are created, and thus also its format.

So when you load a second instance of the same field, the format of the field value of the first instance is used: The same value of the same field cannot have two different formats.

How to solve it? There are several ways:
1) Change the script so that you don't use a field called [DateField] earlier in the script. Call it something else.
2) Drop the earlier field before the second instance is loaded.
3) Format the first field the way you want it.

Further reading:
https://community.qlik.com/t5/Qlik-Design-Blog/Symbol-Tables-and-Bit-Stuffed-Pointers/ba-p/1475369
https://community.qlik.com/t5/Qlik-Design-Blog/Data-Types-in-QlikView/ba-p/1474977

HIC

View solution in original post

2 Replies
hic
Former Employee
Former Employee

Most likely it is caused by the usage of a field called [DateField] earlier in the script. When this field is loaded, its symbol tables are created, and thus also its format.

So when you load a second instance of the same field, the format of the field value of the first instance is used: The same value of the same field cannot have two different formats.

How to solve it? There are several ways:
1) Change the script so that you don't use a field called [DateField] earlier in the script. Call it something else.
2) Drop the earlier field before the second instance is loaded.
3) Format the first field the way you want it.

Further reading:
https://community.qlik.com/t5/Qlik-Design-Blog/Symbol-Tables-and-Bit-Stuffed-Pointers/ba-p/1475369
https://community.qlik.com/t5/Qlik-Design-Blog/Data-Types-in-QlikView/ba-p/1474977

HIC

JeanJordaan
Contributor II
Contributor II
Author

Thank you. 
That was the issue, I updated the code a little and now it all works perfectly.