Jump to content

Please help modify this custom function to respect a list of holidays

Recommended Posts




Our music school needs to modify this custom function to "respect" a list of holidays. This is a great little custom function from Joshua Morton that we found and it works perfectly to calculate if there will be 4 or 5 (ex: Wednesdays) in a given range. We need to to also factor in whether or not there are school holidays in that date range. I was thinking of just keeping a return delimited list of the dates our school is closed each year but I cannot figure out how to make this custom function "respect" that list. I am decent at Filemaker but don't have a clue where to start with a recursive function like this. Any help would be really appreciated!


Best wishes,


~ Tyler

4/4 School of Music



/*_DayCounter ( Date_Start ; Date_End; Days_of_Week )



Joshua Morton - JEM Consulting



Date_Start - any calendar date;

Date_End - any calendar date;

Days_of_Week - a list of days of week (as numbers), separated by carriage returns (1=Sunday, 7 = Saturday).


Data type returned



Returns a number counting only those days in the specified range whose day-of-week is included in the weekDays parameter.


Thanks to Michael Horak, *COMMENT Visual Realisation for their inspiration

July 28, 2010




Case (

Date_Start and not IsEmpty ( FilterValues ( DayOfWeek ( Date_Start ) ; Days_of_Week ) ) ;


1 )




Case (


_DayCounter ( Date_Start + 1 ; Date_End ; Days_of_Week )



Share this post

Link to post
Share on other sites
Jack Rodgers

Regarding functions: their value is that they return data. Note that you can get the same result with Exit Script and use scripts instead of functions.


That said, you are discovering the 'let's add this' scenario that plagues every developer but puts food on the table.


One experienced recommendation is to create a calendar table and have each day have a flag for work day, one for vacation day, one for holiday, etc. Now you can apply attributes to every day that can be useful. You can check this flags in many ways, even manually.


Another simple idea is to add a calculated field for days of the week: Monday = if day of week this date = money, 1, 0


Now you can find a range of dates and sum for Monday, Tuesday...Holiday, work days, weekends, or whatever as easy as pie.


You can create summary totals on a layout page for the range of dates... etc.

Share this post

Link to post
Share on other sites
This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Terms of Use