SETFLDSTATE( ) Function

Example   See Also

Assigns a field or deletion state value to a field or record in a table or cursor.

Syntax

SETFLDSTATE(cFieldName | nFieldNumber, nFieldState
  [, cTableAlias | nWorkArea])

Returns

Logical

Arguments

cFieldName | nFieldNumber

Specifies the name or the number of the field for which the edit or deletion status is assigned. The field number nFieldNumber corresponds to the position of the field in the table or cursor structure. DISPLAY STRUCTURE or FIELD( ) can be used to determine a field's number.

To set the deletion status for the record, include 0 as the field number.

nFieldState

Specifies a value for the field or deletion status. The following table lists the field or deletion state value and the corresponding edit or deletion status:

nFieldState Edit or deletion status
1 Field has not been edited or deletion status has not changed.
2 Field has been edited or deletion status has changed.
3 Field in an appended record has not been edited or deletion status has not changed for the appended record.
4 Field in an appended record has been edited or deletion status has changed for the appended record.

cTableAlias

Specifies the alias of the table or cursor in which the edit or deletion status is assigned.

nWorkArea

Specifies the work area of the table or cursor in which the edit or deletion status is assigned. The field or deletion state value is assigned for the table or cursor open in the currently selected work area if SETFLDSTATE( ) is issued without the optional cTableAlias or nWorkArea arguments.

Remarks

Visual FoxPro uses field state values to determine which fields in tables or cursors are updated. SETFLDSTATE( ) lets you control which fields Visual FoxPro attempts to update, regardless of which fields have been edited in the table or cursor.