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

Script start time and end time

Hi Everyone,

I need some one help to get the below requirement.

I need to get the script start time(system time) and end time(system time), and the below format should store into QVD.Also i need to maintain the history of the Start time and End Time daily(i.e. It shoud not override the data)

  

Task NameStartTimeEnd Time
Reload_Sales29/07/2015 11:20:20 AM29/07/2015 12:40:00 PM

I wrote the following script But am unable to get the Start and End time in same above format.

Start:

LOAD *, now() as Date

  INLINE [

    Task Name, Action

    Reload_Sales, Start Time

] ;

Load A,

       B,

       C

FROM xxxx.qvd;

Start:

LOAD *, now() as Date

  INLINE [

    TAsk  Name, Action

    Reload_Sales, End Time

] ;

Store Start into  time.qvd;

Please correct me where am wrong to get the start and end time in the above mentioned format.

More Thanks in advance,

Ajay

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

HI,

Try like this

LET vStartTime = Now();

Data:

LOAD

*

FROM Data.csv;

LET vEndTime = Now();

ReloadDetails:

LOAD

'Data Table' AS ReloadTable,

'$(vStartTime)' AS StartTime,

'$(vEndTime)' AS EndTime

AutoGenerate (1);


LET vStartTime = Now();

Data1:

LOAD

*

FROM Data1.csv;

LET vEndTime = Now();

Concatenate(ReloadDetails):

LOAD

'Data1 Table' AS ReloadTable,

'$(vStartTime)' AS StartTime,

'$(vEndTime)' AS EndTime

AutoGenerate (1);


// Add new records to QVD


IF Alt(FileSize('c:\Somepath\ReloadDetails.qvd'), 0) > 0 THEN

Concatenate(ReloadDetails)

LOAD

*

FROM ReloadDetails.qvd (qvd);

ENDIF;


STORE ReloadDetails INTO ReloadDetails.qvd;

Hope this helps you.

Regards,

Jagan.


View solution in original post

18 Replies
marcus_sommer

I think you will find here all what you want: https://community.qlik.com/docs/DOC-7177#comment-20906

- Marcus

ajaykumar1
Creator III
Creator III
Author

Thanks Marcus.But i want to store the start time and end time in a qvd.So based on the qvd i will compare my day on day how much time qvds are taking to store.

I hope my requirement is clear.

More Thanks,

Ajay

maxgro
MVP
MVP

Start: load * from time.qvd (qvd);

LOAD *, Timestamp(now()) as Date

  INLINE [

    Task Name, Action

    Reload_Sales, Start Time

] ;

Store Start into  time.qvd;

// ............

LOAD *

FROM a11.qvd

(qvd);

Start:

LOAD *, Timestamp(now()) as Date

  INLINE [

    TAsk  Name, Action

    Reload_Sales, End Time

] ;

Start: load * from time.qvd (qvd);

LOAD *, date(now()) as Date

  INLINE [

    Task Name, Action

    Reload_Sales, End Time

] ;

Store Start into  time.qvd;

ajaykumar1
Creator III
Creator III
Author

Thanks Massimo.

The first line;

start: load * from time.qvd(qvd)?

From where i need to get this initially?

if possible plz add any sample qvw file.

Thanks,

Ajay

maxgro
MVP
MVP

you have to check if the file exists

Re: check if qvd file already exist or not

if the file doesn't exist, skip the first load

ajaykumar1
Creator III
Creator III
Author

Ok...I will check above script tomorrow and get back.

Thanks for your time.

Ajay

marcus_sommer

If you looked through the post and all comments you will find a solution with various additionally informations about the last load to store in a qvd.

- Marcus.

ajaykumar1
Creator III
Creator III
Author

Thanks Massimo,

I have checked and executed your script, and getting following output.

   

Job NameActionDate
Reload_SalesStart time7/29/2015 11:52:05 AM
Reload_SalesStart time7/29/2015 12:30:46 AM
Reload_SalesEnd time7/29/2015 12:52:05 PM
Reload_SalesEnd time7/29/2015 1:30:46 AM

But, I need output like below format in QVD.

   

Job NameStart timeEnd time
Reload_Sales7/29/2015 11:52:05 AM7/29/2015 12:52:05 PM
Reload_Sales7/29/2015 12:30:46 AM7/29/2015 1:30:46 AM

Thanks

Ajay

ajaykumar1
Creator III
Creator III
Author

Hi All,

Any help from any one.

Thanks

Ajay