Show/Hide Toolbars

XSharp

NoteThis command is defined in a header file and will be preprocessed by the X# preprocessor to a function call. If you disable the standard header (-nostddefs) files then this command will not be available. If you tell the compiler to use a different standard header file (-stddef ) then this command may also be not available

Purpose

Assign new values to the contents of one or more fields in the current record.

Syntax

SCATTER [FIELDS <idFieldList> | FIELDS LIKE <Skeleton>
  | FIELDS EXCEPT <Skeleton>] [MEMO] [BLANK]
  | TO ArrayName | MEMVAR
  | NAME ObjectName [ADDITIVE]

Arguments

FIELDS <idFieldList>The list of fields to process. The default is all fields with the exception of memo fields, unless the command supports the MEMO clause.
Only fields with the same names and types in both files are appended.  If fields with the same name do not match in data type, a runtime error is raised.
FIELDS LIKE <Skeleton>You can specify field names with a wild card, such as FIELDS LIKE *name
FIELDS EXCEPT <Skeleton>You can exclude fields, such as for example the primary keys: FIELDS EXCEPT Id
<Skeleton> supports wildcards (* and ?). For example, to replace all fields that begin with the letters A and P, use:
FIELDS LIKE A*,P*

 

Please note that you can combine FIELDS LIKE and FIELDS EXCEPT but you cannot combine a fields list with the LIKE and EXCEPT clauses.

 

MEMOSpecifies that the field list include one or more memo fields.

 

BLANKInclude the BLANK keyword to create a set of empty variables or to fill the array or object with empty values. Each variable is assigned the same name, data type, and size as its field. If a field list is included, a variable is created for each field in the field list.

 

TO <ArrayName>Specifies an array to which the record contents are copied. Starting with the first field, SCATTER copies the contents of each field into each element of the array in sequential order.
SCATTER automatically creates a new array. The array elements have the same size and data types as the corresponding fields.

 

MEMVARScatters the data to a set of variables instead of an array. SCATTER creates one variable for each field in the table and fills each variable with data from the corresponding field in the current record, assigning to the variable the same name, size, and type as its field.

 

NAME <ObjectName>Creates an object whose properties have the same names as fields in the table. To copy the value of each field in the table to each object property, do not include the BLANK keyword. To leave the properties empty, include the BLANK keyword

 

ADDITIVETo update the property values of an existing and valid Visual FoxPro object specified by ObjectName. Using BLANK with ADDITIVE omits the values for existing properties that have matching field names.

 

See Also

GATHER, COPY TO ARRAY, APPEND FROM ARRAY