Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to count buffered records without moving record poin
Message
 
To
09/02/2009 08:28:07
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01379822
Message ID:
01380275
Views:
55
>>Seems like there should be an easy way to do this like reccount could have a parameter to respect "set deleted" or something. Oh well... Got it done. Thanks!
>
>reccount() is extremely fast, and straightforward, because no actual count is done. The information is extracted from the current table - how many records are there.
>
>This doesn't work for any kind of filter condition (including the implicit "set filter on not deleted()" if you SET DELETED ON). In this case, if you do a COUNT, Visual FoxPro has to go through the records and analyze the condition for each record, to see whether it should be included in the count, or not.
>
>You can create a UDF to have a straightforward (but not necessarily fast, especially on large tables) method of counting records. To take buffering into account, you could save the filter to a variable, re-open (USE...AGAIN) the table in another work area, apply the filter, count, save _tally to a variable like lnReturnValue, clean up (close the table and go back to the previous work area), and return lnReturnValue.

Yeah I know how reccount works. I was just wishing (out loud) it could work with set deleted on. Seems like a common thing to want to do. Count records, not deleted ones, pretty basic.
Previous
Reply
Map
View

Click here to load this message in the networking platform