Digitalcandy
IS-IT--Management
I am calculating business days using Ken Hamaday's code below, but I get an error stating that I've exceeded the maximum number of loops. How do I fix it?
//Subtracting Business Days:
WhileReadingRecords;
DateVar Target := Date({Table.DateTime});
NumberVar Add := -20;
NumberVar Added := 0;
WHILE Added > Add
DO (target := target -1;
if dayofweek (target) in 2 to 6
then Added:=Added-1
else Added:=Added);
Target
//Subtracting Business Days:
WhileReadingRecords;
DateVar Target := Date({Table.DateTime});
NumberVar Add := -20;
NumberVar Added := 0;
WHILE Added > Add
DO (target := target -1;
if dayofweek (target) in 2 to 6
then Added:=Added-1
else Added:=Added);
Target