Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Loeckli
Contributor III
Contributor III

Cant not change datatype

I'm trying to change datatype, the data gets loaded over 

SQL Select 

The datatype after the loading is $numeric 2023-08-31 12:46:01.000000, my desired datatype is a date format. 

 I tried different kind of approaches in the front end:

Date(num([My value], 'YYYY-dd-MM hh:mm:ss'), 'dd.MM.YYYY') as t1

(Timestamp#([My Value],'YYYY-dd-MM hh:mm:ss TT '),'dd.MM.YYYY') as t1 

but nothing is working the data type only gets changed to $integer or to text ascii. Does anyone have an idea what I'm missing ?

Labels (5)
10 Replies
marcus_sommer

I did never a closer look with which rules Qlik adds these tags as meta-data to the fields. It are just extra information without much meaning because Qlik has no data-types else Qlik used a data-interpretation to differentiate between numbers and strings which happens by reading the first field-values and/or through the use of conversion/formatting functions and may also end with mixed data (and probably not only in regard to numbers and strings else to sub-types likes dates and timestamps and any different interpretation and/or NULL will have an impact).

Therefore I ignore these tags completely but of course I ensure that my fields have the needed data-interpretation which is especially by dates and times very simple because the facts contain just a pure numeric value for a date and a time - the appropriate parts could be extracted with floor() and frac() - and all other fields comes from the calendar respectively timetable dimensions which are simple self-generated in a loop.

Nevertheless if you want to comprehend the matter more and maybe adjusting the tag-values in some way you may create a small dummy-application with an inline-load and then looking on the results, maybe like:

load *, date(floor(R)) as Date, time(frac(R)) as Time;
load timestamp(timestamp#(T, 'YYYY-MM-DD hh:mm:ss')) as R inline [
T
2023-08-31 12:46:01
];

and playing with different versions of input-data and interpretation functions/variables (those which are usually at the beginning of the script - but they could be changed multiple times during the script). And afterwards you adapt it to your real application.