//Declare all the required variables
Local NumberVar Array CountDays;
Redim CountDays [7];
Local DateVar CheckDate := {?StartDate};
Local NumberVar i;
Local StringVar Display;
//Loop through the date range and increment the array
While CheckDate <> {?EndDate} + 1
Do
(
CountDays [DayOfWeek (CheckDate, CrMonday )] := CountDays [DayOfWeek (CheckDate, CrMonday )] + 1;
CheckDate := CheckDate + 1
);
//Build the display string
For i := 1 to 7
Do
Display := Display & WeekdayName (i, False, crMonday) & " = " & cstr(CountDays[i],0,"") & " day(s)" & chr(13);
//Display the results
"Between " & {?StartDate} & " and " & {?EndDate} & " there are :- " & chr(13) & Display