cancel
Showing results for 
Search instead for 
Did you mean: 

Need to make these functions work to add the repository

Former Member
0 Kudos

Hello:

I need to add the following two functions to the repository, but they both have errors that I don't know how to correct.

#1

// BusinessDays function for calculating the number of business days between a date range

Function (datevar Start, datevar End)

Local NumberVar Weeks;

Local NumberVar Days;

Local Numbervar Hol;

Weeks:= (Truncate (End u2013 dayofWeek(End) + 1 u2013 (Start u2013 dayofWeek(Start) + 1)) /7 ) * 5;

Days := DayOfWeek(End) u2013 DayOfWeek(Start) + 1 +

(if DayOfWeek(Start) = 1 then -1 else 0) +

(if DayOfWeek(End) = 7 then -1 else 0);

// Count the number of holidays in the date range

Local NumberVar i;

For i := 1 to Count (Holidays)

do (if DayOfWeek ( Holidays<i> ) in 2 to 6

and Holidays<i> in Start to End then Hol:=Hol+1 );

// Calculate the number of business days

Weeks + Days u2013 Hol

#2

Function () DateVar Array

// List of the holidays to exclude from business days calc

Holiday := [

Date (2009,01,01), // New Years Day

Date (2009,01,19), // Martin Luther King, Jr.

Date (2009,02,16), // Presidents Day

Date (2009,05,25), // Memorial Day

Date (2009,07,04), // Independence Day

Date (2009,09,07), // Labor Day

Date (2009,10,12), // Columbus Day

Date (2009,11,11), // Veterans' Day

Date (2009,11,26), // Thanksgiving Day

Date (2009,12,25) // Christmas Day

];

Thank you very much!

Deanna

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

The error is "The Remaining text doesn't appear to be part of the formula. "

Thanks!

Deanna

Former Member
0 Kudos

What is highlighted in the formula when this error is given?

Carl

Former Member
0 Kudos

What is highlighted in the formula when this error is given?

Carl

JWiseman
Active Contributor
0 Kudos

hi Deanna,

can you please repost these as separate questions and also include what the error you get is for each post?

thanks,

jamie