[Remind-Fans] the first 3 consecutive working days of the month

Paul Pelzl pelzlpj at eecs.umich.edu
Sat Jan 20 12:35:03 EST 2007


On Sat, Jan 20, 2007 at 01:43:50PM +0000, T E Schmitz wrote:
> I have puzzled over this for a few days but unfortunately can't get this
> to work myself:
> 
> I am looking for a sequence of the first 3 consecutive non-omitted days
> at the beginning of every month where:
> - day3 >= 1st
> - day1 = day3 - 2
> - day1 is the trigger date

Yeah, this is tricky.  I think this does about the right thing:

FSET _prev_month(d_date) date(year(d_date), (monnum(d_date)+10)%12 + 1, day(d_date))

REM 1 SATISFY 1
REM SCANFROM [trigger((trigdate()))] SATISFY !isomitted(trigdate()-2) && !isomitted(trigdate()-1) && !isomitted(trigdate()) 
REM [trigger(trigdate()-2)] MSG beginning of three consecutive non-omitted days

REM 1 SATISFY 1
REM SCANFROM [trigger(_prev_month(trigdate()))] SATISFY !isomitted(trigdate()-2) && !isomitted(trigdate()-1) && !isomitted(trigdate())
REM [trigger(trigdate()-2)] MSG beginning of three consecutive non-omitted days



My strategy here is:
   1) Find the first day of next month
   2) Scan forward from this date for the first day which satisfies the 
      "3 consecutive non-omitted days" logic (this will find the end of
      the block of three days)
   3) Schedule a reminder for the beginning of this block of three days
   4) Do 1-3 again, starting from the first day of *this* month.

I think it's hard to do this without two different reminders due to the
"edge effects" at month boundaries.  If "today()" is Jan 30 2007, then
"REM 1 SATISFY 1" triggers on Feb 1--exactly where we want to be
scanning to figure out whether Jan 30 2007 is the start of a block of
non-omitted days.  However, if "today()" is Feb 3 2007, then "REM 1
SATISFY 1" triggers on Mar 1... and we probably want to be looking
around Feb 1 instead.

Paul





More information about the Remind-fans mailing list