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

T E Schmitz mailreg at numerixtechnology.de
Fri Jan 26 06:37:03 EST 2007


Paul Pelzl wrote:
> 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
> 
> 
> 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.



Hello Paul,
Thank you very much for posting the above explanations.
I used this as a learning exercise and eventually came up with 
something, then compared it to your solution. The approach was pretty 
much the same. ;-) (I located the 1st, then scanned from the second last 
day of the previous month.)

I had forgotten to mention that weekends also need to be omitted but 
that can be handled easily by specifying that the trigger day (day 1) 
has to be a Mon, Tue, or Wed.

Unfortunately, I have also come to the conclusion that I need to scan 
twice: 1) the previous month and the current month as one doesn't know 
whether this month's set has been covered already.

For instance, on 1st April 2007, I scan from 30th March and find the 
trigger date is ahead on 2nd Apr.
When running this on 3rd April though, I find that April has been done 
already and I scan for the May set.

I only do the second scan/remind if the first one results in a past 
date. I presume, otherwise I would get 2 reminders for the same date in 
a calendar?

Best regards,

Tarlika Elisabeth



More information about the Remind-fans mailing list