Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to tell when Set Filter returns no records
Message
From
06/05/1998 01:38:42
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
05/05/1998 13:20:21
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00097082
Message ID:
00097237
Views:
19
>>>I'm using a query which uses the set filter to command. Good so far. But when the result of the set filter is no records, I need to be able to test for that, so I can take some action (message or otherwise). I see that RECC() doesn't respect the Set Filter to command. Can anyone tell me what does?
>>>
>>>Thanks!
>>>
>>>Sylvia
>>
function filterhasrecords
>>locate
>>return !eof()
Cetin
>
>Great thanks! By the way, I also tried a simple count to l_nreccount which returned a 0, and then I tested for this value. Is this method going to be slower than locate?
>
>Sylvia
Sylvia,
When expression would lead to 0 recs, I think count, locate, go top etc would nearly be equal. But I would still suggest locate if you use set filter for one reason. Supposing your expression would waste some time to filter, if result is not 0 records then you would set filter after count which would double the time (in fact less than double but still more than one pass). On 0 records situation clearing a filter is fast. Another approach on large table (and buffering) is to do an SQL to a true cursor, do edits in that cursor, and write changes to table (faster on large tables - drammatically where filter not optimizable).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform