I'm trying to get the below formula to work but I keep getting an error message(A loop was evaluated more than the maximum number of times allowed. ).
Any help would be greatly appreciated.
Local DateTimeVar d1 := {HoursOverDueNoNationalLogistics.DUE_DATE};
Local DateTimeVar d2 := CurrentDate;
Local numberVar DaysToCompare:= DateDiff ("d", d1, d2) ;
Local numberVar LoopCounter := 0;
Local numberVar DaysDifference := 0;
while LoopCounter <= (DaysToCompare - 1) do (
if (Day (d1) <> crSunday) and (Day(d1) <> crSaturday) then
DaysDifference = DaysDifference + 1;
d1 = DateAdd ("d", 1, d1);
LoopCounter = LoopCounter + 1;
);
DaysDifference;
Any help would be greatly appreciated.
Local DateTimeVar d1 := {HoursOverDueNoNationalLogistics.DUE_DATE};
Local DateTimeVar d2 := CurrentDate;
Local numberVar DaysToCompare:= DateDiff ("d", d1, d2) ;
Local numberVar LoopCounter := 0;
Local numberVar DaysDifference := 0;
while LoopCounter <= (DaysToCompare - 1) do (
if (Day (d1) <> crSunday) and (Day(d1) <> crSaturday) then
DaysDifference = DaysDifference + 1;
d1 = DateAdd ("d", 1, d1);
LoopCounter = LoopCounter + 1;
);
DaysDifference;