Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
marciofreireteixeira
Contributor
Contributor

Behavior of a timestamp field.

Hi.

I'm doing a select an instance from a SqlServer database that has a timestamp field with the value '2020/08/13 14: 10: 49.093333'. But, It happens that when I write this instace in a QVD file, the value of this timesstamp field is zeroed at the end Ex: '2020/08/13 14: 10: 49.093000'. His behavior is like he is rounding the milliseconds.

Would you have any tips on how to solve this problem, writing the value read correctly in the QVD?

4 Replies
Kushal_Chawda
MVP
MVP

It's probably because of your timestamp variable in Main tab of the script

SET TimestampFormat='DD/MM/YYYY h:mm:ss[.fff] ';

change the highlighted part as below up to the decimal point you want

SET TimestampFormat='DD/MM/YYYY h:mm:ss[.fffffff]';

marciofreireteixeira
Contributor
Contributor
Author

I did it, but the behavior remains the same.

marcus_sommer
MVP
MVP

You are right, Qlik is rounding the number because they has more digits as the from Qlik used numerical system could handle, see for it: Rounding-Errors 

To store the whole value you could load these values as strings. Usually much better than this is to split the value into a date- and a time-field and only if the milliseconds are really important to store them within an extra millisecond-field. Most calculations/matchings could be done in this way and you will save a lot of RAM with it.

- Marcus

Kushal_Chawda
MVP
MVP

I tried loading the data value like below

Data:   
LOAD * Inline [
Time
2020/08/13 14:10:49.093333 ];

 

then  I set the Timestamp format in load script exactly as data value like above

SET TimestampFormat='YYYY/MM/DD h:mm:ss[.fff]';

 

I can see the same value.

snapshot before Timestamp format set  (you can see it is text. Left aligned)

Annotation 2020-08-18 235132.png

 

 

 

 

snapshot after Timestamp format set  (you can see it is Timestamp format. Right aligned)

Annotation 2020-08-18 235213.png