Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a expression like:
interval("Stop time" - "Start Time",'mm') as "Stop-StartTime"
Now I have an expression like below:
if("Stop-StartTime"> interval(40,'min'), 1,0) as P1P2Breached.
However,
It is always showing 0.
Can you please help me on this.
Thanks,
Sarif
Note that Interval() is only formatting the text part of a dual value, it is not changing the underlying number.
In a numeric comparison, you don't need to format the values,
So either trust QV to interpret '00:40:00' correctly (which it may not, depending on default format codes and automatic number parsing)
if("Stop-StartTime"> '00:40:00'), 1,0) as P1P2Breached
or create the minutes number like
if("Stop-StartTime"> Maketime(0,40), 1,0) as P1P2Breached
interval(40,'mm') Returns 57600
interval('0:40','mm') Returns 40 (not min)
so using this Expression should give you correct result
if("Stop-StartTime"> interval('0:40',mm), 1,0) as P1P2Breached.
But why you use interval(40,mm) and not only > 40?
Note that Interval() is only formatting the text part of a dual value, it is not changing the underlying number.
In a numeric comparison, you don't need to format the values,
So either trust QV to interpret '00:40:00' correctly (which it may not, depending on default format codes and automatic number parsing)
if("Stop-StartTime"> '00:40:00'), 1,0) as P1P2Breached
or create the minutes number like
if("Stop-StartTime"> Maketime(0,40), 1,0) as P1P2Breached
sorry. My expected expression is:
if("Stop-StartTime"> 40, 1,0) as P1P2Breached