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: 
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

18 Replies
jagan
Partner - Champion III
Partner - Champion III

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.


qlikviewwizard
Master II
Master II

Hi ajaykumar1

Please close the thread if you get the answer. Thank you.

maxgro
MVP
MVP

let vStartTime=Timestamp(now());

trace vStartTime=$(vStartTime);

SLEEP(1000);

if FileSize('time.qvd')>0 then

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

ENDIF;

time:

LOAD

'Reload_Sales' as TaskName,

'$(vStartTime)' as StartTime,

Timestamp(now()) as EndTime

AutoGenerate 1;

Store time into time.qvd;

ajaykumar1
Creator III
Creator III
Author

Thanks Jagan.Its working perfectly as earlier asked.

One more thing; is this script stores the start time if in case the script hanged(like without completion of the task).

It means if in case before completion of the QVD if the task hangs whether start time will capture ?

or when only completion of the task then only both start time and end time is will capture?

More Thanks,

Ajay

ajaykumar1
Creator III
Creator III
Author

Hi Qlikviewwizard,

I will definitely close the thread ,that will be helpful for others whoever required.

Sorry if in case any convenience caused to you 🙂

Regards,

Ajay

jagan
Partner - Champion III
Partner - Champion III

Hi,

Before storing the QVD if your reload fails it won't store in QVD, the start time and end time will be in the variables and once the task finished the data is stored in the QVD.

If you got the answer please close this thread by giving Correct and Helpful Answers to the posts which helps you.

Regards,

Jagan.

ajaykumar1
Creator III
Creator III
Author

Thanks Jagan for your clarification.

Anonymous
Not applicable

Try This

Let Vmin = Timestamp(now());

Data:

LOAD

*

FROM Data.csv;

Let Vmax = Timestamp(now());
 
Time:
Load * INLINE [
Reload, Start, End
'Relaod_Sales',$(Vmin),$(Vmax)
]
;

Anonymous
Not applicable

Let Vmin = Timestamp(now());

Table:
LOAD *
FROM
[sample.xlsx]
(
ooxml, embedded labels, table is Sheet1);


Let Vmax = Timestamp(now());

Time:
Load * INLINE [
Reload, Start, End
'Relaod_Sales',$(Vmin),$(Vmax)
]
;

OldTime:
LOAD Reload,
Start,
End
FROM

(
qvd);


STORE Time into 'C:\Users\manoj_nair09\Downloads\Time.qvd'(qvd);


DROP TABLE Table;