peggysuebaker
Technical User
I have my formula below. I copied this from faq767-4465 posted 21 Nov 03. I get an error saying "date-time is required" here for the StartDate field I am using. It shows as a date field in Crystal so I'm not sure what I am suppose to do now. I usually make very basic reports so please try to explain details for me if you are able to help. Thanks so much.
WhilePrintingRecords;
//Set the values of Start Date and End Date
DateVar StartDate:= Date({InitialContact.DateReceivedCC});
DateVar EndDate:= Date({InitialContact.AttemptDate1});
//Find out the difference in days and subtract the weekends
NumberVar DaysDiff:= DateDiff("d",StartDate,EndDate)-
DateDiff("ww",StartDate,EndDate,crsaturday)-
DateDiff("ww",StartDate,EndDate,crsunday);
//Create an array of Holiday dates
Local DateVar Array Holidays:=MakeArray(
Date(2011,01,01),
Date(2011,01,18),
Date(2011,05,31),
Date(2011,07,05),
Date(2011,09,06),
Date(2011,11,11),
Date(2011,11,25),
Date(2011,11,26),
Date(2011,12,24),
Date(2011,12,31));
//Loop through the array checking if each holiday is within the dates
Numbervar Counter :=0;
While UBound(Holidays) <> Counter do
(Counter := Counter +1;
If Not(dayofweek(Holidays[Counter]) in [1,7])and
Holidays[Counter] in StartDate to EndDate then DaysDiff := DaysDiff-1;
//Display result to 0 decimal places and no thousand separator (DaysDiff,0,"");
WhilePrintingRecords;
//Set the values of Start Date and End Date
DateVar StartDate:= Date({InitialContact.DateReceivedCC});
DateVar EndDate:= Date({InitialContact.AttemptDate1});
//Find out the difference in days and subtract the weekends
NumberVar DaysDiff:= DateDiff("d",StartDate,EndDate)-
DateDiff("ww",StartDate,EndDate,crsaturday)-
DateDiff("ww",StartDate,EndDate,crsunday);
//Create an array of Holiday dates
Local DateVar Array Holidays:=MakeArray(
Date(2011,01,01),
Date(2011,01,18),
Date(2011,05,31),
Date(2011,07,05),
Date(2011,09,06),
Date(2011,11,11),
Date(2011,11,25),
Date(2011,11,26),
Date(2011,12,24),
Date(2011,12,31));
//Loop through the array checking if each holiday is within the dates
Numbervar Counter :=0;
While UBound(Holidays) <> Counter do
(Counter := Counter +1;
If Not(dayofweek(Holidays[Counter]) in [1,7])and
Holidays[Counter] in StartDate to EndDate then DaysDiff := DaysDiff-1;
//Display result to 0 decimal places and no thousand separator (DaysDiff,0,"");