Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why reccount() and _tally are different ?
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00097511
Message ID:
00097522
Views:
29
>>Is there an explanation why RECCOUNT() doesn't return the right value in the following code ?
>>
>>
>>create table t1 (f1 C(1))
>>insert into t1 (f1) VALUES ("A")
>>
>>create table t2 (f1 C(1))
>>insert into t2 (f1) VALUES ("B")
>>index on f1 tag f1
>>
>>select "t1"
>>scan
>>	SELECT * FROM t2 WHERE f1 = t1.f1 INTO CURSOR tmp
>>	? reccount()  && display 1
>>	? _tally      && display 0
>>endscan
>>
>>
>>RECCOUNT() returns 1 while it is supposed to return 0. This problem occurs only if you create an index on f1 in table t2. Without the index, it returns 0.
>>
>>Thanks.
>
>_TALLY should always be used since FoxPro will sometimes created another open instance of the table with a filter when creating the result set. In these cases the value returned by RECCOUNT() is the same as the original table.

Thanks for the fast response!

If I understand correctly, using _TALLY after a query will always give me the right value, right?

What do I use if I want the number of records in an opened table?
1-SELECT * from alias_name TO SCREEN NOCONSOLE and then use _tally OR
2-RECCOUNT("alias_name")

thanks.
François Guay
EMail: fraguay@videotron.ca
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform