Share via


FOR Clauses

A FOR clause causes a command to act on each record that meets the specified logical condition. FOR clauses have the following syntax:

The following example stores low balance in the alert field of all records that contain less than 500 in the total field.

FOR lExpr
REPLACE ALL alert WITH "low balance" FOR total < 500

Remarks

The following table lists commands in which you can use a FOR clause.

Commands That Use FOR Clauses

APPEND FROM ARRAY

COUNT

LOCATE

APPEND FROM

DEFINE PAD

RECALL

AVERAGE

DELETE

REPLACE FROM ARRAY

BLANK

DISPLAY

REPLACE

BROWSE

EXPORT

REPORT

CALCULATE

FOR( )

SCAN...ENDSCAN

CHANGE

INDEX

SORT

COPY TO ARRAY

LABEL

SUM

COPY TO

LIST

 

Using the FOR clause can speed operation of single-table commands. For more information about performance enhancement, see Optimizing Applications.

See Also

Reference

REPLACE Command (Visual FoxPro)

Scope Clauses

WHILE Clauses

Other Resources

Field and Record Manipulation

Data Manipulation