Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
I have the Hour field which has values from 00 to 23.
I need to split this hour into two shifts.
Shift1 : 06 to 20
Shift2 : 19 to 13 (this 13 is next day)
I tried with the below condition in the script but it is not working as expected.
IF(Hour >='06' and Hour<='20','Shift1',
IF(Hour >='19' or Hour <='13','Shift2')) AS SHIFTS,
Can someone please help me with the script?
You will have to concatenate instead of using if here
Table:
LOAD ...,
'Shift 1' as Shift
FROM ...
Where Hour >='06' and Hour<='20';
Concatenate (Table)
LOAD ...
'Shift 2' as Shift
FROM
Where Hour >='19' or Hour <='13';
These shifts are overlapping?
Yes Sunny
So somebody coming in at 19:30 will have both Shift1 and Shift2? Is that what you are looking to do?
Not exactly.
People who work at shift1 may extend their timings.
But there were two actual shifts.
Hi Experts,
i have attached a sample of my data. please help.
Looks good, what is the issue?
Sunny,
Shift1 is ok. but if you see Shift2, it is not having all the hours between 19 and 13.
i know it will be overlapping. but that is what the requirement.
You will have to concatenate instead of using if here
Table:
LOAD ...,
'Shift 1' as Shift
FROM ...
Where Hour >='06' and Hour<='20';
Concatenate (Table)
LOAD ...
'Shift 2' as Shift
FROM
Where Hour >='19' or Hour <='13';
Your if condition is wrong it is working for Shift1 only because second condition is overlapping so better you can find another way on script part.
I did not get your file once get i let you know.
Regards,
Anand