troubleshooting Question

Goalposts Moved on VFP Cursors?

Avatar of Mike Jacobs
Mike JacobsFlag for United Kingdom of Great Britain and Northern Ireland asked on
SoftwareFoxPro* VFP
8 Comments1 Solution189 ViewsLast Modified:
I appear to have a deep misunderstanding of how VFP cursors work

My code is littered with examples like this as the quickest way to establish the presence of a record meeting arbitrary conditions where a simple INDEXSEEK isn't appropriate


This has worked for years.
Suddenly it doesn't.

I was so shocked, I assumed that either my data or my VFP installation had become corrupt.

I eliminated the former by trying it on various different tables from different sources

I eliminated the latter by first, thoroughly uninstalling all traces of VFP, then reinstalling it.

Then repeating the experiment on two other workstations where I had VFP installed.

The result is consistent.

What actually happens is that the Cursor is created with a filter matching (ANYCONDITION) and, if you're running this from a command line, for a few seconds you see the result you expect (eg 0 Records if you know that no records match the condition)  but then the status bar displays the name of the Cursor, its table of origin and the result count followed by RECCOUNT() of the original table (and now Cursor) (eg "Junk (path to table) Record 1/(RECCOUNT('ANYTABLE')") . The cursor is displaying the result count because it is now in a filter which matches ANYCONDITION.  But if I clear the filter (SET FILTER TO) what I have is a full copy of (ANYTABLE) in cursor JUNK.

In contrast, if, instead of  INTO CURSOR 'JUNK' I use INTO DBF 'JUNK' the results are exactly what I expect.


1 am I deluded in my expectation that the contents of CURSOR should be identical to the contents of the DBF equivalent?

2 If so, how on earth have I been getting away with it up to now? My software has often depended on this simple test and up till about a week ago neither I nor my clients have ever encountered a problem resulting from the use of such code

3 If not (i.e. we all agree that CURSORS should behave in accord with my prior expectations) how on earth could this behaviour change, simultaneously, on 3 different VFP workstations? (which don't even have the same version of Windows 10 running)
Pavel Celba
All in One

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros