Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

if condition not working

Hi Experts,

I m trying to write if condition for a time like below in the script

if(DeliveryTime >= '10:00:00' and DeliveryTime <= '15:00:00' ,1,0) as Flag.

but this is not working. Is anything wrong in the expression?

Can someone please help

20 Replies
sorrakis01
Specialist
Specialist

Can you upload an example? or try this Time#(DeliveryTime,'hh:mm:ss') as DeliveryTime

Not applicable
Author

what should i use if i have time in this format

42747.582638889

sorrakis01
Specialist
Specialist

Hi Pr,

This is your format? Wich is the original data? Oracle? Unix? It's a concatenate field?

Regards

Not applicable
Author

yes. this is my format. data is from sql

sunny_talwar

May be this:

If(Frac(DeliveryTime) >= MakeTime(10) and Frac(DeliveryTime) <= MakeTime(15), 1, 0) as Flag.

susovan
Partner - Specialist
Partner - Specialist

You can also try this process ,

Time:

LOAD Time as @_Time

FROM

Table3.xlsx

(ooxml, embedded labels, table is Sheet1);

LOAD *,

if(Timestamp(@_Time,'hh:mm:ss')='10:00:00' and @_Time,'hh:mm:ss')='15:00:00',1,0) as @_Time_Flag

Resident Time;

Warm Regards,
Susovan
Not applicable
Author

no sunny.

Not working.

I have attached sample data.

Please help

Not applicable
Author

its not working

sunny_talwar

Seems to be working for me

Table:

LOAD [Delivery Id],

    TimeStamp([Delivery Time]) as [Delivery Time],

    If(Frac([Delivery Time]) >= MakeTime(10) and Frac([Delivery Time]) <= MakeTime(15), 1, 0) as Flag

FROM

[..\..\Downloads\Time test.xls]

(biff, embedded labels, table is Sheet1$);

Capture.PNG

annafuksa1
Creator III
Creator III

Please check my app