Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare time with string

Hello,

I make a sql query that gets an array of time values and I want to show only the values that are bigger than a specific value that I save on a string.

The value I save to a string it is another time value saved on my script.

The condition I have is:

=if(hour(sqlTimeArray)<=strTime,1,0)

But this condition does not work and shows all the values I have on the array.

Am I doing something wrong?

Thanks in advance.

Regards,

Ivo

1 Solution

Accepted Solutions
Kushal_Chawda

try this

=if( interval(sqlTimeArray,'hh')<= interval(time#(strTime,'hh:mm:ss'),'hh'),1,0)

View solution in original post

7 Replies
Kushal_Chawda

what is format of sqlTimeArray & StrTime?

Not applicable
Author

sqlTimeArray has time values, for example: 12:26:30

StrTime I formated has "time", so also in the same format, ex: 14:08:05

sasikanth
Master
Master

HI,

Try like this

hour(Date(Date#(time_string,'hh:mm:ss'),'hh:mm:ss'))

settu_periasamy
Master III
Master III

Hi,

Try Like

=if(hour(sqlTimeArray)<=hour(strTime),1,0)

or

if(Interval('sqlTimeArray','HH')<Interval('strTime','HH'),1,0)

Kushal_Chawda

try this

=if( interval(sqlTimeArray,'hh')<= interval(time#(strTime,'hh:mm:ss'),'hh'),1,0)

Not applicable
Author

Apparently with this solution it works.

Thank you.

Kushal_Chawda

I am glad that it was helpful