Skip to content

[VFP] Unimplemented _Tally system variable #2024

Description

@cpyrgas

Found this code, which is currently causing a parser error XS9002: Parser: unexpected input ':='

COUNT FOR stocklist.Selected = .T.
nCount = _tally

There are two issues here:


Here is the complete list of commands that change _TALLY (well, we think it’s complete—we tried a bunch of undocumented stuff):

Append From
Average
Blank
Calculate
Copy To
Copy To Array
Count

Delete
Delete-SQL
Export
Index
Pack
Recall
Reindex

Replace
Replace From Array
Select-SQL
Sort
Sum
Update-SQL

Actually, JOIN, TOTAL and UPDATE are documented as changing _TALLY, too, but they’re so obsolete, we didn’t even test them. A good thumbrule is that _TALLY is updated by every command that displays a record count when TALK is ON.

Generally, _TALLY contains the number of records affected by the command. So, after DELETE, it has the number of records deleted; after REPLACE, _TALLY contains the number of records that had a field replaced.

However, there's one real oddity on this list. _TALLY after REINDEX contains the number of records for which the last tag indexed applies. If you have filtered tags (indexes using a FOR clause), _TALLY returns the number of records contained in the last index. "Last" here refers to the creation order of the tags, since they're re-created in the same order. This isn't really a big problem since we suggest you never use REINDEX anyway.

In VFP 3 and VFP 5, when TALK is OFF, INDEX and REINDEX don't update _TALLY. This bug is fixed in VFP 6.

Activity

  1. RobertvanderHulst commented on Sep 24, 2026

    @RobertvanderHulst
    Member

    Please retest. Most commands should now work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

FoxProFoxPro dialectRuntimeUDCUser Defined Commands

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions