John

I think this does what you want:

DatesInRange ( startDate ; endDate ; weekDay ; interval ) =

Let ([
         s = GetAsDate ( startDate ) ;
         sDow = DayOfWeek ( s ) ;
         firstDate = s + weekDay - sDow + If ( sDow > weekDay ; 7 )
       ] ;
       Case (
                  firstDate > GetAsDate ( endDate ) ; "" ;
List ( firstDate ; DatesInRange ( firstDate + 7 * interval ; endDate ; weekDay ; interval ) )
                 )
       )


cheers

Tom

On 1 Mar 2009, at 13:40, John Wenmeekers wrote:

Hi all,

I have some trouble extending a CF I use.

To generate a list of dates between two given dates, narrowed down to
chosen days I use:

Case (
startDate and not IsEmpty ( FilterValues ( DayOfWeek ( startDate ) ;
weekDays ) ) ;
startDate & ΒΆ
)
&
Case (
startDate < endDate ;
WeekDaysInRange ( startDate + 1 ; endDate ; weekDays )
)

as recursive CF, where weekdays is a checkbox field with the days of the
week.

What I need now is a range of dates between two given dates, but with one
parameter more.
The checkbox weekDays field is changed to a radiobutton (one choice only) and the result needs to be the interval between start and end date but 'every
week', 'every 2 weeks', 'every 3 weeks', 'every 4 weeks'.

So the result would be f.i. every date of a Wednesday, every 2 weeks, if the radiobutton holds Wednesday and the interval holds 2, for the time between
the given startDate and endDate.

Any idea/hint welcome.

TIA

Reply via email to