# Every second an third monday in odd numbered month

This topic is 7018 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

I'm strugging to grasp how to make two loops in recursive custom functions ...can anyone??? The result must be a return/pilcrow delimited list of dates within a span from day1 until day2....

--sd

##### Share on other sites

In general, you could either use a secondary function or piggy back a parameter as shown

But in the example given, one could simply:

- move 2 months forward;

- if 2nd Monday is in range - 2nd Monday & � &

- if 3rd Monday is in range - 3rd Monday & �

##### Share on other sites

Alright then - to the problem to make the prefix work, how would you make a calc that goes true 2nd monday en each month ...Choose(DayOfWeek(Date( ....seems a little clunkcy and not particular flexible???

--sd

##### Share on other sites

I don't understand the question: What is 'the prefix'? And what is 'true 2nd monday'?

BTW, note that the iCal does NOT provide this option.

##### Share on other sites

I use the custom function MatchPrefixAll( to sift out the dates made in another custom function where if a date matches a certain criteria it gets prefixed. This means that it all falls on me being able to write these conditions into a function that is flexible enough to do more that if DayOfWeek is equal to 1 then prefix the date - such as the header of this thread.

--sd

##### Share on other sites

I am lost.

I think you have made it clear what the desired output should be.

What is the input? Specifically, what is the user input and what can be hard-coded?

In iCal, if you choose 'every n-th month', you can then specify 'every m-th k DayOfWeek'. It will not let you have more than one instance of any one variable.

Do you want the user to be able to specify more than one m? Or is the 'second and third' a fixed thing?

##### Share on other sites

The user inputs a startdate and an untildate, and wishes to have all the 2nd mondays in odd numbered month if posible.

The userinterface is very close to the one in palmOS except it's not the first date that pulls but a day in the first week.

--sd

##### Share on other sites

Doesn't really answer my questions (I don't have Palm), but see if the attached gets you anywhere.

twiceInBlueMoon.fp7.zip

##### Share on other sites

I think it does ...but I need to investigate it. Thanks!!!

--sd

##### Share on other sites

Right, this one does what I wish for, or rather I could restrain the demands to this:

Let ( [

start = Extend ( StartDate ) ;

end = Extend ( EndDate ) ;

interval = Extend ( MonthInterval ) ;

k = Extend ( Every ) ;

wDay = Extend ( WeekDay ) ;

i = Get ( CalculationRepetitionNumber ) - 1 ;

day1 = Date ( Month ( start ) + interval * i ; 1 ; Year ( start ) ) ;

diff = wDay - DayOfWeek ( day1 ) ;

add = Mod ( diff ; 7 ) + 7 * ( k - 1 ) ;

] ;

Case ( start <= reccurence and reccurence <= end ; reccurence )

)

But since I use custom functions for other ways of recurrences, would it be great to have it as CF giving a pilcrow-delimited list of usefull dates - otherwise would I need to convert the other plicrow delimited lists created into a repeating calc'field ...which of course is a posibility, and a good question why I refreain from it??

So if you right of the bat can turn it a CF ...might it contribute pretty well to my doubts

--sd

##### Share on other sites

Indeed! ...it's really straight forward, it requires a new way of thinking for me - that I ought to have picked up some time ago ...but really havn't!!!

Thanks a lot!

--sd

##### Share on other sites

I think comment hovers six inches off the floor. He probably thought that up while he was making himself a sandwich.

##### Share on other sites

Let's not get carried away, shall we?

First, it's really quite trivial to convert a recursive repeating field calc to a custom function.

Second, it's not THAT complex a calc. (Incidentally, I could point you to some of my posts that *I* thought were the cat's pajamas - but no one else seemed to care.)

Finally, I do NOT hover six inches off the floor. The best I have managed so far is 5 1/2.

##### Share on other sites

This topic is 7018 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account