Share via


Scope Clauses

If a Visual FoxPro command has a Scope clause, you can specify a range of records for the command to act on.

Clauses

The following table describes the clauses you can use for Scope.

Scope

Description

ALL

Affects all records in the table.

NEXT nExpr

Affects the next nExpr number of records beginning with the current record.

In the following example, the REPLACE command acts on the current record and the two following records:

REPLACE status WITH "open" NEXT 3

RECORD nRecordNumber

Affects only the specified record number.

Note

Unlike the other scope clauses, which are relative to the number of records in the table and to the current position of the record pointer, the RECORD scope clause always acts on the specified physical record number. Therefore, RECORD nRecordNumber does not respect the values of SET FILTER or SET DELETED.

In the following example, the REPLACE command acts on record number 5:

REPLACE status WITH "open" RECORD 5

REST

Affects a range of records beginning with the current record and ending with the last record in the table. In the following example, the REPLACE command stores a null value in the remaining records:

REPLACE status WITH .NULL. REST

You can also specify record ranges using FOR and WHILE clauses. For more information, see FOR Clauses and WHILE Clauses.

See Also

Reference

REPLACE Command (Visual FoxPro)

Other Resources

Data Manipulation

Field and Record Manipulation