CompletionDate ( )

Function stats

Average user rating
38
338
9999
Support
FileMaker 7.0 +
Date posted
14 October 2012
Version
1
Recursive function
Yes

Author Info
 Daniele Raybaudi

9 functions

Average Rating 5.0

author_avatar



 

Function overview

Prototype

CompletionDate  ( StartDate;   WorkingDays;   HolidayList )


Parameters

StartDate  


WorkingDays  


HolidayList  


Description

Tags:  Date  

Returns a date that is "n" working days from StartDate.

Examples

Sample input

CompletionDate ( "12/21/2012 ; 2 ; HolidayList )


Sample output

12/27/2012

 

Function code

/* CompletionDate ( StartDate ; WorkingDays ; HolidayList )

Returns a date that is "n" working days from StartDate.

Daniele Raybaudi
*/

Let(
IsWorkingNextDay = DayOfWeek ( StartDate + 1 ) > 1 and DayOfWeek ( StartDate + 1 ) < 7 and IsEmpty ( FilterValues ( StartDate + 1 ; HolidayList ) ) ;
Case(
not WorkingDays ; StartDate ;
CompletionDate ( StartDate + 1 ; WorkingDays - IsWorkingNextDay ; HolidayList )
)
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/338

    Prototype: CompletionDate( StartDate; WorkingDays; HolidayList )
    Function Author: Daniele Raybaudi (http://www.fmfunctions.com/mid/38)
    Last updated: 14 October 2012
    Version: 1

*/
// ===================================

 

Comments

Matt Durante
27 November 2012



The function works very well so far. I am relatively new to Filemaker and am having trouble using the holidaylist portion of the function. How do I get the script to recognize my holidaylist table once I create it? I keep getting the error that "the specified table cannot be found".
Do I need to relate it? All of my attempts to relate it have failed thus far which leads me to believe that I'm overlooking something.
It works when I use a singular date, or a repeating field in place of Holidaylist, but whenever I try to get it to recognize the whole list of holidays (as different records in the same field) I either get the aforementioned error, or it only uses the (holiday) record that I was viewing.
Any feedback would be appreciated.
  General comment
Daniele Raybaudi
27 November 2012



HolidayList must be a list of values ( dates ).
You need to create a vale list from the field "date" of your holidaylist table and then use the ValueListItems ( ) native FileMaker's function, something like:

CompletionDate ( StartDate; WorkingDays; ValueListItems ( Get ( FileName ) ; "YourValueListNameInQuotes" ) )
  General comment

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (32)
Date  (28)
XML  (26)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Layout  (15)
Interface  (15)
Text  (14)
Variables  (12)
Filter  (11)
Layout Objects  (11)
Design  (10)
Array  (8)