2 Replies Latest reply: Feb 14, 2011 11:33 AM by Steve Free RSS

    IF statements in load with Weekday

       

      Hi - thanks in advance for any replies.

      I use the following as part of a load script to recognise trading hours

      (OOH is out of hours, INH is in hours)

      I need the load to populate [DayShift] based on the following:

       

      INH which is 8am-9pm Mon-Fri and 9am-5pm on Saturday. Any hours outside of this are OOH.



      This is the load code I have tried but it does not load any INH, everything OOH - any ideas?

      if(Weekday(DateLeadReceived) = 'Sat' AND time(timestamp(DateLeadReceived, 'YYYY-MM-DD hh:mm:ss.fff')) >= '09:00:00' AND time(timestamp(DateLeadReceived, 'YYYY-MM-DD hh:mm:ss.fff')) <= '17:00:00','INH',

      (if((Weekday(DateLeadReceived) <> 'Sun' OR Weekday(DateLeadReceived) <> 'Sat') AND time(timestamp(DateLeadReceived, 'YYYY-MM-DD hh:mm:ss.fff')) >= '08:00:00' AND time(timestamp(DateLeadReceived, 'YYYY-MM-DD hh:mm:ss.fff')) <= '21:00:00','INH','OOH'))) as [DayShift],