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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
IAMDV
Master II
Master II

*** Load Script - Autogenerate for 5 seconds Interval ***

Dear All,

I hope someone can help me. I am generating a Load Script which has seconds interval between 8/8/2011 to 8/21/2011.

Something like this...

StartTimeEndTime
08/08/2011  00:00:0108/08/2011 00:00:05
08/08/2011  00:00:0608/08/2011 00:00:10
08/08/2011  00:00:1108/08/2011 00:00:15

My idea is to use the TimeStamp Function and format the numbers. Please suggest if there is better approach. I understand I can quickly do it in Excel but I wanted to achieve this in QV.

Thanks in advance.

Cheers - DV

3 Replies
swuehl
MVP
MVP

Hi D V,

try something like this:

LOAD

timestamp(daystart(makedate(2011,8,8))+(recno()-1)*5/(60*60*24)+1/(60*60*24)) as starttime,

timestamp(daystart(makedate(2011,8,8))+(recno()*5/(60*60*24))) as endtime

autogenerate 60/5*60*24*13;

Regards,

Stefan

erichshiino
Partner - Master
Partner - Master

Hi, DV

This is the script you need. You may need to adjust the limits.

load MakeDate(2011,8,8)+ rowno()/24/60/12 as end,

(MakeDate(2011,8,8)+ (rowno()-1)/24/60/12)+(1/24/60/60) as start

AutoGenerate( (MakeDate(2011,8,21) - MakeDate(2011,8,8) ) * 24 * 60 * 12  );

The ideia, is to use autogenerate to create as many lines as you want. Then, I use rowno() to increase the timestamp according to the line within the loop.

To add 5 seconds, imagine that a date or a timestamp is an integer where each day is equal to 1. Then, 1 second is 1/24/60/60 and 5 seconds is 1/24/60/12

Hope it helps,

Erich

IAMDV
Master II
Master II
Author

Thanks guys. This is more complex than I have asked. Because the StartDate and EndTime change and also the interval time changes dynamically. I'll come back to you guys with more questions.

Many thanks again for your help.

Erich - I hope you are doing well. Nice to see you active on community.

Cheers - DV