Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- RLIB 3.0a Reference - <b>function:</b> cfta() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function:    CFTA()

Purpose:     Copy database field values to an array (Copy Fields To Array)

Syntax:      CFTA( array [, memcopies [, first [, last ]]] )

Arguments:   array       - Existing array to receive field values from the
                           database fields.

             memcopies   - Optional logical flag to fill the array values
                           from existing public memory variables with the
                           same names as database fields.

             first       - Optional numeric value indicating the first
                           field in the database to copy.  If not
                           specified the default is field #1.

             last        - Optional numeric value indicating the last
                           field in the database to copy.  If not
                           specified the default is FCOUNT().

Returns:     True if all field values copied successfully.

Description: Function to copy values of each field in the current record
             of the currently selected database into the array specified,
             optionally indicating to copy these values from existing
             public memory variables with the same names as the database
             fields.

             This function is useful for stacking database record data
             into and out of arrays.  The companion function is CATF() to
             copy array values to fields, and the
             MEMORIZE()-MREPLACE()-FORGET() team of functions.  Typically
             a database's record contents are placed in PUBLIC variables
             with MEMORIZE(), edited, then saved back to the database with
             MREPLACE(), then released with the FORGET() function.  CATF()
             and CFTA() let you temporarily hold and stack these field
             values into arrays which can be later retrieved, or copied
             (saved) into the database, or another database with the same
             structure.  This forms a nice set of functions for simply
             manipulating data among numbers of databases that share the
             same structure.

Notes:       Assumes that ARRAY has at least FCOUNT() elements.

             The database whose structure defines the fields being copied
             MUST be currently selected since CFTA() uses the field
             definitions from the currently selected database for its
             operations.

Example:     *-- swap data between record #1 and record #2 in a database
             DECLARE rec1[FCOUNT()], rec2[FCOUNT()]

             GOTO 1               && record #1
             CFTA(rec1)           && copy field values to rec1 array
             GOTO 2               && record #2
             CFTA(rec2)           && copy field values to rec2 array
             CATF(rec1)           && shove in record #1's field values
             GOTO 1               && back to record #1
             CATF(rec2)           && copy rec2 array field values in

Source:      RL_CFTA.PRG

See also:    CATF(), FORGET(), MEMORIZE(), MREPLACE()

See Also: CATF() FORGET() MEMORIZE() MREPLACE()

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