Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 Name | StartTime | End Time |
Reload_Sales | 29/07/2015 11:20:20 AM | 29/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
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.
Hi ajaykumar1
Please close the thread if you get the answer. Thank you.
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;
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
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
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.
Thanks Jagan for your clarification.
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)
];
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
(
STORE Time into 'C:\Users\manoj_nair09\Downloads\Time.qvd'(qvd);
DROP TABLE Table;