Replaces the data in the current record of the currently selected table with data from an array, a set of variables, or an object.

GATHER FROM ArrayName | MEMVAR | NAME ObjectName
   [FIELDS FieldList | FIELDS LIKE Skeleton | FIELDS EXCEPT Skeleton]
   [MEMO]

Parameters

FROM ArrayName

Specifies the array whose data replaces the data in the current record. The contents of the elements of the array, starting with the first element, replace the contents of the corresponding fields of the record. The contents of the first array element replace the first field of the record; the contents of the second array element replace the second field, and so on.

If the array has fewer elements than the table has fields, the additional fields are ignored. If the array has more elements than the table has fields, the additional array elements are ignored.

MEMVAR

Specifies the variables or array from which data is copied to the current record. Data is transferred from the variable to the field that has the same name as the variable. The contents of a field are not replaced if a variable doesn't exist with the same name as the field.

NoteTip

You can create variables with the same names as fields by including MEMVAR or BLANK in SCATTER.

NAME ObjectName

Specifies an object whose properties have the same names as fields in the table. The contents of each field are replaced by the value of the property with the same names as the fields. The contents of a field are not replaced if a property doesn't exist with the same name as the field.

FIELDS FieldList

Specifies the fields whose contents are replaced by the contents of the array elements or variables. Only the field specified with FieldList has its contents replaced.

FIELDS LIKE Skeleton | FIELDS EXCEPT Skeleton

You can selectively replace fields with the contents of array elements or variables by including the LIKE or EXCEPT clause or both. If you include LIKE Skeleton, Visual FoxPro replaces the fields that match Skeleton. If you include EXCEPT Skeleton, Visual FoxPro replaces all fields except those that match Skeleton.

Skeleton supports wildcards (* and ?). For example, to replace all fields that begin with the letters A and P, use:

 CopyCode imageCopy Code
GATHER FROM gamyarray FIELDS LIKE A*,P*
MEMO

Specifies that the contents of memo or Blob fields are replaced with the contents or array elements or variables. If you omit MEMO, memo and Blob fields are skipped when GATHER replaces the contents of fields with the contents of an array or variable. General and picture fields are always ignored in GATHER, even if you include the MEMO keyword.

Expand imageExample

Expand imageSee Also