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

Error in Script !!

HEy,

I am having error in following script.

Can you tell me what is the error ??

I have to Sum the Duration for Event = Server_DOWN and (StartTime >= Downtime_StartTime)  and (EndTime <= Downtime_EndTime)

Script :

=Sum({<Event = {'Server_DOWN'} and PurgeChar(Time(StartTime, 'hh:mm:ss'), ':') >= PurgeChar(Time(Downtime_StartTime, 'hh:mm:ss'), ':') and PurgeChar(Time(EndTime , 'hh:mm:ss'), ':') <= PurgeChar(Time(Downtime_EndTime , 'hh:mm:ss') , ':')> }Duration)

Thanks

6 Replies
alexandros17
Partner - Champion III
Partner - Champion III

At first change the and into comma so :


Sum({<Event = {'Server_DOWN'} , .... Duration)


the second condition must be written again unfortunately you cannot use functions (purgechar in this case) at the left side so you need to compute that value in the script, let's say myvalue. With these conditions the expression change into:


myvalue = {'$(>=PurgeChar(Time(Downtime_StartTime, 'hh:mm:ss'), ':')<=PurgeChar(Time(Downtime_EndTime , 'hh:mm:ss') , ':') )'}


anbu1984
Master III
Master III

=If(Event = 'Server_DOWN' and PurgeChar(Time(StartTime, 'hh:mm:ss'), ':') >= PurgeChar(Time(Downtime_StartTime, 'hh:mm:ss'), ':') and PurgeChar(Time(EndTime , 'hh:mm:ss'), ':') <= PurgeChar(Time(Downtime_EndTime , 'hh:mm:ss') , ':'), Sum(Duration))

nikhilgarg
Specialist II
Specialist II
Author

Hey,

This is not working. What to do ??

rajeshvaswani77
Specialist III
Specialist III

Hi Nikhil,

Break it in small parts and make each small part work, else it will be difficult to find what's not causing it to work.

thanks,

Rajesh Vaswani

nikhilgarg
Specialist II
Specialist II
Author

I used following script but still it is showing  :  00:00:00

=Sum({<Event= {'Server_DOWN'} , KeyStartTime= {">= KeyDowntime_StartTime"}, KeyEndTime= {"<= KeyDowntime_EndTime"} >} Duration)

anbu1984
Master III
Master III

Any errors? Can you post sample app.

In script, don't use = before If

If(Event = 'Server_DOWN' and PurgeChar(Time(StartTime, 'hh:mm:ss'), ':') >= PurgeChar(Time(Downtime_StartTime, 'hh:mm:ss'), ':') and PurgeChar(Time(EndTime , 'hh:mm:ss'), ':') <= PurgeChar(Time(Downtime_EndTime , 'hh:mm:ss') , ':'), Sum(Duration))