Joe De Ville wrote: > How about this? > > How about this? (new/changed code in blue/bold) > > SELECT "luHolidays" > && build a text list of the holiday dates > SCAN > STORE lcTextList_Dates + chr(13) + TRANS( dDate ) TO lcTextList_Dates > ENDSCAN > > . . . > > lnCtr = lnCtr + EVALUATE(tcCursor + > ".nEstimatedTime") - EVALUATE(tcCursor + ".nActualTime") > lnNumDaysFromNow = INT(lnCtr / tnMaxHrs) > ldDate = DATE() && starting date > lnLoop = 0 > DO WHILE lnLoop <= lnNumDaysFromNow > IF NOT(INLIST(DOW(ldDate),1,7) OR > TRANS(ldDate) + CHR(13) $ lcTextList_Dates,"luHolidays","dDate")) THEN && > only count if not a weekend > and not a holiday > lnLoop = lnLoop + 1 > ENDIF > ldDate = ldDate + 1 > ENDDO && WHILE lnLoop <= lnNumDaysFromNow > REPLACE nTimeSpent WITH lnCtr, dExpected WITH ldDate ; > IN (tcCursor) > >
Hi Joe! Just so you know, the list only takes plain Jane vanilla text messages, and no HTML messages are shown, iirc. Thanks for the idea, but I'll pass on that one. I'm leaning towards just doing a SELECT dDate from MyLanHolidayTable into cursor MyLocalCursor and then indexing the dDate field and SEEKing on that. I think that might work the best. Also, after looking at my initial IF construct, I'd rather rewrite it from a theoretical standpoint as this, to aid in short-circuiting the evaluation should the first condition fail: IF NOT INLIST(DOW(ldDate),1,7) AND NOT SEEK(ldDate,"luHolidays","dDate") I'm not a big fan of so many NOTs in an expression (as I think it's sometimes harder to read), but in this case, it's not so bad, and like I said...it'll most likely run faster since the first condition--if failed--would cause the program to abort the IF construct, if I'm not mistaken. (That's a purist debate some other time, perhaps!) I suppose I could have even did better with this: IF BETWEEN(DOW(ldDate),2,6) AND NOT SEEK(ldDate,"luHolidays","dDate") <g> -- Michael J. Babcock, MCP MB Software Solutions, LLC http://mbsoftwaresolutions.com http://fabmate.com "Work smarter, not harder, with MBSS custom software solutions!" _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.