Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Algorithm for missing dates.
Message
From
31/07/2009 16:58:33
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
31/07/2009 10:26:27
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01415572
Message ID:
01415723
Views:
55
>>>Guess I didn't explain well or ask the question right. Getting the dates to/from SQL was the easy part. The hard part is converting it all to a string that properly adds periods for the missing(holiday and weekend) dates.
>>>
>>>Your solution would give me a cursor that includes missing dates... halfway there. Walking that cursor could work, but I have to solve another issue with skipping/ignoring completely empty weeks.
>>>
>>If you have a cursor with all dates and some indicator, that this date is missing, then what seems to be a problem of scanning this cursor and using if/endif logic for . ?
>
>Mostly the IF/ENDIF logic. ;) Having to account for missing days at the beginning, middle and end of the week, plus skipping to the next week when necessary. Long day and it was getting muddled in my head. New day, new ideas, something should work.

Actually with David's cursor, you only need a different walk that you first had in mind. Build pieces of string week by week, and check whatever you need to check, omit what you need etc.

Generally, whenever I was working with timeslots (in any increment, from 5 minutes to a day), I found that building a full set of records for every conceivable slot, and then matching it for the ones I actually have, was the simplest way out of any such problem. Specially the problem when you have to know when to end, i.e. if you're checking for next slot - well, no need to check whether we're past the end slot, because the endscan statement will take care of that.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform