Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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$);
Try
if(DeliveryTime >= Date('10:00:00') and DeliveryTime <= Date('15:00:00') ,1,0) as Flag.
Your line of code should work, I just tried and it works:
if(DeliveryTime >= '10:00:00' and DeliveryTime <= '15:00:00' ,1,0) as Flag
why should i use Date() here?
its not working
overworked 🙂
if(DeliveryTime >= Time('10:00:00') and DeliveryTime <= Time('15:00:00') ,1,0) as Flag.
I used the following sample code and it works:
Data:
Load *,
if(DeliveryTime >= '10:00:00' and DeliveryTime <= '15:00:00' ,1,0) as Flag;
LOAD * INLINE [
Product,Color,SoldQty,DeliveryTime
70060306, BLACK, 58,10:00:00
70060306, BURGUN, 37,20:00:00
70060306, MULTI, 18,20:00:00
70380479, BLACK, 35,20:00:00
70380479, BROWN, 35,20:00:00
70380479, PINK, 13,20:00:00
60190130, BLACK, 22,20:00:00
60190130, NUDE, 35,20:00:00
60190130, WHITE, 15,20:00:00
70480047, BLACK, 45,20:00:00
70480047, SILVER, 16,11:00:00
70480047, WHITE, 8,15:00:00
60360830, BLACK, 40,20:00:00
60360830, NAVY, 12,20:00:00
60360830, PINK, 16,20:00:00
];
Hi,
How is the format of DeliveryTime in the script or in the original data?
Regards
no not working
it is hh:mm:ss format