Click to See Complete Forum and Search --> : Loop Error


Babs827
August 1st, 2005, 10:11 AM
I have the following code in my selection criteria (using CR 10):

Global datetimevar firstDate:= datetime(year(CurrentDateTime), month(CurrentDateTime),1,0,0,0) ;
Global datetimevar lastMonth:= dateadd("m",+0,firstDate);
lastMonth:=dateadd("d",-1, lastMonth);

if {ENG_ORD_MERGE_VW.SHP_DT} = lastMonth
then
Do
lastMonth:=dateadd("d",-1, lastMonth)
While {CTDATE.WRK_DAY} <> 1.00 ;


The report appears to be searching records but then part way through it kicks me out with this error message:

"A loop was evaluated more than the maximum number of times allowed"

What is the maximum number of times a loop can be evaluated? I didn't think there was a limit. Does anyone know how I can write this so that it won't kick me out?

Madhi
August 3rd, 2005, 03:44 AM
You need to increase or decrese {CTDATE.WRK_DAY} in the loop
Otherwise it will result in infinite loop

Babs827
August 25th, 2005, 04:30 PM
I can't increment the WorkDay because all workdays need to equal 1, will it work if I put in a dummy counter, just to increment 1?