Friday, February 8, 2013

Playing with DOW() in V9


At one point I was called upon to determine the day of the week and fire off different emails from starlims depending on the day.  That led me to some doodling with the Dow() function that I figured I would share.

:DECLARE myary, strDate;

:BEGINCASE;
  :CASE DoW(Today())=1; /*SUNDAY;
         strDate := Today() + 1;
  :EXITCASE;
  :CASE DoW(Today())=2;
         strDate := Today() +7;
  :EXITCASE;
  :CASE DoW(Today())=3;
         strDate := Today() +6;
  :EXITCASE;
  :CASE DoW(Today())=4;
         strDate := Today() +5;
  :EXITCASE;
  :CASE DoW(Today())=5;
         strDate := Today() +4;
  :EXITCASE;
  :CASE DoW(Today())=6;
         strDate := Today() +3;
  :EXITCASE;
  :CASE DoW(Today())=7;
         strDate := Today() +2;
  :EXITCASE;
:ENDCASE;


No comments:

Post a Comment