Brian Dunning's FileMaker Custom Functions

EventCount ( DateBegin ; DateEnd ; Frequency ; When )

Counts the number of times a repeating event will occur between two dates.

  Average rating: 4.3 (40 votes) Log in to vote

Jonathan Stark   Jonathan Stark
Jonathan Stark Consulting
http://jonathanstark.com/

Share on Facebook Share on Twitter

  Sample input:
CountEvents ( "1/1/2007" ; "6/1/2007" ; "Once" ; "5/14/1976" ) // Returns 0
CountEvents ( "1/1/2007" ; "6/1/2007" ; "Once" ; "5/14/2007" ) // Returns 1
CountEvents ( "1/1/2007" ; "6/1/2008" ; "Yearly" ; "5/14" ) // Returns 2
CountEvents ( "1/1/2007" ; "6/1/2007" ; "Monthly" ; "1" ) // Returns 6
CountEvents ( "1/1/2007" ; "6/1/2007" ; "Monthly" ; "15" ) // Returns 5
CountEvents ( "1/1/2007" ; "6/1/2007" ; "Monthly" ; "0" ) // Returns 5 (0 represents the last day of the month, -1 would represent the second to last day of the month, etc.)
CountEvents ( "1/1/2007" ; "1/6/2007" ; "Weekly" ; "Monday" ) // Returns 1
  Sample output:
Count the number of times a repeating event will occur between two dates.

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

NAME
EventCount

DESCRIPTION
Count the number of times a repeating event will occur between two dates.

PARAMETERS
DateBegin: The start date of the range to be checked.
DateEnd: The stop date of the range to be checked.
Frequency: Text describing the length of the repetition. Supported values are Once, Yearly, Monthly, Weekly, and Daily.
When: Text representing the point in the frequency arc when the event hits. The expected format depends on the type of frequency specified.

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth:

Under construction. Email me your wish list for improvements.