Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Sharbel
Contributor III
Contributor III

Load

Hi,

I have the following table :

smobariki_0-1674307339188.png

I would like to write  Load script that adds to the above table another column named Shift as follows:

smobariki_1-1674307452005.png

note that when   :

1.time_in---> between 06:00-15:00 it returns Morning

2.time_in---> between 15:01-22:59 it returns Evening

3.time_in---> between 23:00-23:59 or between 00:00 - 05:59 (the next day) it returns Night

thanks,

Sharbel

 

 

 

Labels (3)
1 Solution

Accepted Solutions
BrunPierre
Partner - Master
Partner - Master

Hi @Sharbel 

Perhaps like this?

If(Time(time_In) >= Time('06:00') and Time(time_In) <= Time('15:00'),'Morning',
If(Time(time_In) >= Time('15:01') and Time(time_In) <= Time('22:59'),'Evening',
If(Time(time_In) >= Time('23:00') and Time(time_In) <= Time('23:59') and Time(time_In) >= Time('00:00') or Time(time_In) <= Time('05:59'),'Night'))) as Shift

View solution in original post

3 Replies
BrunPierre
Partner - Master
Partner - Master

Hi @Sharbel 

Perhaps like this?

If(Time(time_In) >= Time('06:00') and Time(time_In) <= Time('15:00'),'Morning',
If(Time(time_In) >= Time('15:01') and Time(time_In) <= Time('22:59'),'Evening',
If(Time(time_In) >= Time('23:00') and Time(time_In) <= Time('23:59') and Time(time_In) >= Time('00:00') or Time(time_In) <= Time('05:59'),'Night'))) as Shift

Sharbel
Contributor III
Contributor III
Author

Hi ,

I am not sure the "Night" is calculated right since it is supposed to refer to time_in the following day and not the same day as you suggested above

 

any ideas?

 

sharbel

BrunPierre
Partner - Master
Partner - Master

If(Time(time_In) >= Time('06:00') and Time(time_In) <= Time('15:00'),'Morning',
If(Time(time_In) >= Time('15:01') and Time(time_In) <= Time('22:59'),'Evening',
If(Time(time_In) >= Time('23:00') and Time(time_In) <= Time('23:59') and or Time(time_In) >= Time('00:00') or and Time(time_In) <= Time('05:59'),'Night'))) as Shift