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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Getting a timestamp into a variable

Hi guys,

I have a timestamp field within a table.  I would like to now get that timestamp field (don't need to change formatting) into a variable to use within a Where clause on another table.

The peek function removes the time piece and rounds up the time which is no good.  Need to keep the time as well.

Thanks,

Mark

1 Solution

Accepted Solutions
Not applicable
Author

Thanks Gysbert.  Boy - I don't know what was happening earlier, but all is fine.  But thank you for your clarification on what I should expect from the peek function and for your time. 

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I very much doubt peek truncates your timestamp. I've never seen it do that. Try putting this in your script and reload:

T1:

load now(1) as MyTimeStamp

autogenerate 1 ;

LET vMyTime = peek('MyTimeStamp');

Now open the variable editor (ctrl+alt+v) and look at the value of the new variable vMyTime. It should still have the time part.

Are you really sure the timestamp date was stored as a timestamp? Do you dollar-expand the variable?

i.e something like this:

load * from test.qvd (qvd) where MyTimeField > $(vMyTime);  //if MyTimeField isn't a timestamp use the timestamp# function on it.

Can you post the qvw document you're working on, or at least the script?


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks Gysbert.  Boy - I don't know what was happening earlier, but all is fine.  But thank you for your clarification on what I should expect from the peek function and for your time.