Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

paulyeo11
Not applicable

SQL load script how to compute start and end time as download ?

Hi All

I want to know how to write in SQL for the above mentioned.

after load below script :-

CONNECT TO [Provider=SQLOLEDB.1;Persist Security Info=False;User ID=SA;Initial Catalog=andonDatabas;Data Source=Paul;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=PAUL;Use Encryption for Data=False;Tag with column collation when possible=False];

select * from record_produksi_plc;

select * from record_downtime_plc;

select * from record_reject_detail_plc;

I get 2 field name , downtime_start_time and downtime_stop_time. i like to compute :-

downtime=downtime_start_time - downtime_stop_time


How to do it ?


Paul

1 Solution

Accepted Solutions
sergey_maka8
Not applicable

Re: SQL load script how to compute start and end time as download ?

Hi Paul,

Try this

LOAD

*,

downtime_start_time - downtime_stop_time AS downtime

select *

from record_downtime_plc;

Regards,

Sergey

3 Replies
sergey_maka8
Not applicable

Re: SQL load script how to compute start and end time as download ?

Hi Paul,

Try this

LOAD

*,

downtime_start_time - downtime_stop_time AS downtime

select *

from record_downtime_plc;

Regards,

Sergey

sergey_maka8
Not applicable

Re: SQL load script how to compute start and end time as download ?

Or it would be better

Time(Num(downtime_end_time)-Num(downtime_start_time),'s')

You will have downtime in seconds


Regards,

Sergey

paulyeo11
Not applicable

Re: SQL load script how to compute start and end time as download ?

Hi Sir

Thank you for sample code help a lot , it work now :-

LOAD

*,

Time(Num(downtime_end_time)-Num(downtime_start_time),'s') as downtime_;

//downtime_end_time - downtime_start_time AS downtime;

select * from record_downtime_plc;

Paul