Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
mhmmd_srf
Creator II
Creator II

Condition is not working on Minutes.

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

1 Solution

Accepted Solutions
swuehl
MVP
MVP

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

View solution in original post

3 Replies
Anonymous
Not applicable

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?

swuehl
MVP
MVP

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

mhmmd_srf
Creator II
Creator II
Author

sorry. My expected expression is:

if("Stop-StartTime"> 40, 1,0) as P1P2Breached