Command SCATTER NAME Foundation
Copies data from the current record to a DataObject.
SCATTER [FIELDS <FieldNameList] NAME <oData> [IN <nWorkArea>|<cAlias>] [ADDITIVE]
SCATTER FIELDS EXCEPT <SkeletonList> NAME <oData> [IN <nWorkArea>|<cAlias>] [ADDITIVE]
SCATTER FIELDS LIKE <SkeletonList> [EXCEPT <SkeletonList>] NAME <oData> [IN <nWorkArea>|<cAlias>] [ADDITIVE]
The command SCATTER NAME copies data from the current record of a work area to a data object. By default, SCATTER NAME first creates a new DataObject, and then adds an exported member variable for each field selected via the FIELDS, FIELDS EXCEPT or FIELDS LIKE argument. If no fields are specified, all fields in the current record are copied.
The ADDITIVE option can be used to copy the data to an existing data object. In this case, the value in each field is copied to the corresponding member variable of the data object. If none exists, a new member variable is added. Other member variables of the data object are left unchanged. If ADDITIVE is not used or if no data object is specified in the <oData> argument, a new DataObject is created by SCATTER NAME which only has the data from the fields specified to the command.
/// - opens a dbf table and loads record #5 into a DataObject
/// - closes table and shows data stored in DataObject
PROCEDURE Main
LOCAL oCustomer
USE customer
GO 5
SCATTER NAME oCustomer
? FCount() // 13
? oCustomer:lastname // Hellstrom
? oCustomer:custNo // 5
? Len( oCustomer ) // 13
SCATTER FIELDS lastname, firstname NAME oCustomer
? oCustomer:lastname // Hellstrom
? oCustomer:custNo // NIL (undefined/not copied)
SCATTER FIELDS EXCEPT "notes", "*name" NAME oCustomer
? oCustomer:lastname // NIL (undefined/not copied)
? oCustomer:custNo // 5
USE
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.