Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- NetLib for Clipper, Version 6.0 - n_gather( [ <afieldnames> , ] <adata> ) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_GATHER( [ <aFieldNames> , ] <aData> )


Parameters

<aFieldNames>
Optional array containing the names of the fields to replace.

<aData>
Array containing data to move to corresponding fields in the currently 
selected record.


Returns

Logical true if successful, otherwise false. On failure, obtain an 
exact error code by calling N_ERROR().


Description

If only one array is passed, then all fields in the current record are 
replaced with the corresponding array element. The number of fields 
replaced is equal to the lesser of:

        Number of elements in the array
        Number of fields in the record

If the number of elements in the array is greater than the number of 
fields in the record, then trailing array elements are ignored.

If two arrays are passed, NetLib assumes that the first array contains 
names of fields to replace with corresponding elements of the second 
array. The second array must have at least as many elements as the 
first, or the result is undefined (but probably undesirable).


Example

// Initialize fields in new record with values of last
DECLARE aData[FCOUNT()]

GOTO BOTTOM
N_SCATTER(aData)

APPEND BLANK
N_GATHER(aData)

// Replace selected fields
DECLARE aFields[3], aData[3]
aFields[1] = 'City'
aFields[2] = 'State'
aFields[3] = 'ZIP'
GOTO BOTTOM
N_SCATTER(aFields, aData)
APPEND BLANK
N_GATHER(aFields, aData)

// Update a record
DECLARE aData[FCOUNT()]
SEEK nKey
DO WHILE !RLOCK()
ENDDO
N_SCATTER(aData)
FOR i := 1 TO LEN(aData)
  @ i, 1 SAY FIELDNAME(i) + ': ' GET aData(i)
NEXT i
READ
IF N_UPDATED(aData) .AND. LASTKEY() != 27
  N_GATHER(aData)
ENDIF
UNLOCK



See Also: N_SCATTER() N_UPDATED()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson