Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
clausbarlose
Contributor III
Contributor III

Autogenerate timestamps, based on input from Excel

Happy New Year to all!

I want to autogenerate timestamps based on input from an Excel sheet.

In short, purpose is to decide whether timestamps from another table, collides in time with periods in the Excel sheet.

Autogenerated timestamps must be in five minutes intervals.

Excel input file layout:

StartTimestamp, EndTimestamp, Comment

e.g.

2015-01-12 14:00:00, 2015-01-14 17:00:00, Relase #101515

2015-02-25 23:00:00, 2015-02-26 03:00:00, Release #224355

...

Hopefully someone has tried this before?

Best regards,

Claus

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Something like this:

LOAD

     StartTimestamp,

     TimeStamp(StartTimestamp+(IterNo()-1)/24/12) as TimeStamp

     EndTimestamp,

     Comment

FROM

     MyExcelFile.xlsx (ooxlm, ...etc)

WHILE

     StartTimestamp+(IterNo()-1)/24/12 <= EndTimestamp

     ;

If your excel timestamps aren't timestamps but text strings then you first need to use the timestamp# function to turn the strings into numeric timestamp values: timestamp#(StartTimestamp,'YYYY-MM-DD hh:mm:ss') as StartTimestamp


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

Something like this:

LOAD

     StartTimestamp,

     TimeStamp(StartTimestamp+(IterNo()-1)/24/12) as TimeStamp

     EndTimestamp,

     Comment

FROM

     MyExcelFile.xlsx (ooxlm, ...etc)

WHILE

     StartTimestamp+(IterNo()-1)/24/12 <= EndTimestamp

     ;

If your excel timestamps aren't timestamps but text strings then you first need to use the timestamp# function to turn the strings into numeric timestamp values: timestamp#(StartTimestamp,'YYYY-MM-DD hh:mm:ss') as StartTimestamp


talk is cheap, supply exceeds demand
clausbarlose
Contributor III
Contributor III
Author

Hi Gysbert

Thank you very much - works exactly as it I wanted!

Best regards

Claus