Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reccount()
Message
From
25/01/2010 16:15:26
Luis Navas
Independent Consultant
Auckland, New Zealand
 
 
To
25/01/2010 16:03:44
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01445855
Message ID:
01445895
Views:
26
>>>>>>>>>Note that reccount() returns the total number of records - and it does so quickly. The total number of records may included deleted records, and records that don't match the current filter criteria. To get only records that you see on screen, use the COUNT command instead - or use an SQL - SELECT command.
>>>>>>>>
>>>>>>>>is it the same
>>>>>>>>
>>>>>>>>nump=count("mytable")
>>>>>>>>
>>>>>>>>?
>>>>>>>
>>>>>>>There is no COUNT function, but you can do
>>>>>>>
>>>>>>>set deleted on
>>>>>>>select count(*) from myTable into array laCount
>>>>>>>
>>>>>>>lnRecords = laCount[1]
>>>>>>
>>>>>>can i use reecount and keep count in mind if i run into something later?
>>>>>
>>>>>Reccount() will show you the total number of records in a table. Typically reccount() is rarely used, while _tally is frequently used. For instance after a select statement, you should NEVER use reccount(), instead you should always use _tally.
>>>>
>>>>Hi Toren I understand you should not use reccount() if you don't add the nofilter or readwrite clause to the select, but other than that is fine to use it, or am I wrong?
>>>>
>>>>Luis
>>>
>>>What about Set filter settings, and deleted records? I don't even consider using reccount(), since _tally will ALWAYS give me the correct info.
>>
>>
>>But you wrote after a Select statement, and in that case Reccount() will work fine, also Reccount() will ALWAYS give you correct info, the person that uses Reccount() could get confused if he does not understand what the function is returning, but the functions works fine all the time. :-)
>
>Not if you forget to add nofilter or readwrite...! Why not play safe, and use the value that will always give you what you really want anyway?

It's safer to use NoFilter and ReadWrite all the time.

Also _Tally had problems in the past http://my.advisor.com/articles.nsf/aid/12139
I'm not arguing _Tally is a good solution, but your statement was not true at least to me, so I thought maybe I didn't know about a bug in Reccount() and that's why I asked.

I personally like Reccount() since you can assign an alias to the function.

Cheers.

Luis
I never forget a face, but in your case I will make an exception :-)
Previous
Reply
Map
View

Click here to load this message in the networking platform