Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I seperate blocks of time in a table?
Message
From
05/01/2005 16:14:24
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
00973326
Message ID:
00974519
Views:
23
David,

Thanks! Sorry for the late reply but, this works great! May I ask a question about your coding? I notice that you use "i" as part of your naming? I was wondering what that means? Your "t" I would assume to mean time. I am fairly new to coding, just trying to understand the different naming conventions out there.


>Chad,
>
>
>create cursor x1 ( tWhen t, iCount i )
>insert into x1 values ( {^2004-12-30 12:36:55}, 0 )
>insert into x1 values ( {^2004-12-30 12:57:24}, 45 )
>insert into x1 values ( {^2004-12-30 15:43:08}, 389 )
>insert into x1 values ( {^2004-12-30 19:35:06}, 871 )
>insert into x1 values ( {^2004-12-30 20:00:00}, 872 )
>insert into x1 values ( {^2004-12-30 23:26:00}, 1339 )
>insert into x1 values ( {^2004-12-31 03:19:59}, 1836 )
>
>create cursor production ( iElapsedTime i, iIntervalCount i, iSecondsPerPiece i )
>
>select x1
>go top
>ltLastTime = x1.tWhen
>liLastCount = x1.iCount
>skip
>scan rest
>   ltElapsedTime = x1.tWhen - ltLastTime
>   liElapsedCount = x1.iCount - liLastCount
>   insert into production values ( ltElapsedTime, liElapsedCount, ltElapsedTime / liElapsedCount )
>   ltLastTime = x1.tWhen
>   liLastCount = x1.iCount
>endscan
>
>
>You can then scan through the production table looking for rows where iSecondsPerPiece exceeds some acceptable average value and flag these the "breaks" you want.
>
>>I have a table with fields: time, date, count. I am trying to seperate the table based on breaks in the time entries and the counts.
>>
>>As an example;
>>
>>
>>Time Count
>>12:36:55 0
>>12:57:24 45
>>15:43:08 389
>>19:35:06 871
>>20:00:00 872
>>23:26:00 1339
>>03:19:59 1836
>>
>>What I am trying to do is, seperate this table.
>>I want my program to "see" the break between the (Time 19:35:06 Count 871) and (Time 20:00:00 Count 872). There is a visible Time/Count discrepency of nearly 25 minutes while producing only One extra piece. I want the counts between 0 and 871 seperated from the next set (872 and 1836).
>>
>>Can anyone lead me down the road to an answer? Or, if there is more information that I have left out, let me know. I will try to answer to the best of my ability.
Thanks,

Chad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform