I am using CR XI
In the Working Days Between 2 Dates Formula (see below), when I check the formula for errors, in the part of the formula that accounts for a holiday on the line:
For i := 1 to Count (Holidays)
an error occurrs "A field is required here", and the variable Holidays in parenthesis is highlighted.
Has anyone run across this error when trying to use this formula and is there a fix?
This formula is in the report header:
BeforeReadingRecords;
DateTimeVar Holidays := Date(2013,05,27);
0
////Main formula
WhileReadingRecords;
Local DateTimeVar Start := {INTAKE.DECISION_DATE}; // place your Starting Date here
Local DateTimeVar End := {@Activity Date}; // place your Ending Date here
Local NumberVar Weeks;
Local NumberVar Days;
Local Numbervar Hol;
DateTimeVar Holidays;
Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0) +
(if DayOfWeek(End) = 7 then -1 else 0);
Local NumberVar i;
For i := 1 to Count(Holidays)
do (if DayOfWeek ( Holidays ) in 2 to 6 and
Holidays in start to end then Hol:=Hol+1 );
Weeks + Days - Hol;
In the Working Days Between 2 Dates Formula (see below), when I check the formula for errors, in the part of the formula that accounts for a holiday on the line:
For i := 1 to Count (Holidays)
an error occurrs "A field is required here", and the variable Holidays in parenthesis is highlighted.
Has anyone run across this error when trying to use this formula and is there a fix?
This formula is in the report header:
BeforeReadingRecords;
DateTimeVar Holidays := Date(2013,05,27);
0
////Main formula
WhileReadingRecords;
Local DateTimeVar Start := {INTAKE.DECISION_DATE}; // place your Starting Date here
Local DateTimeVar End := {@Activity Date}; // place your Ending Date here
Local NumberVar Weeks;
Local NumberVar Days;
Local Numbervar Hol;
DateTimeVar Holidays;
Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0) +
(if DayOfWeek(End) = 7 then -1 else 0);
Local NumberVar i;
For i := 1 to Count(Holidays)
do (if DayOfWeek ( Holidays ) in 2 to 6 and
Holidays in start to end then Hol:=Hol+1 );
Weeks + Days - Hol;