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> mreplace() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function:    MREPLACE()

Purpose:     Replace fields with memory variables created with MEMORIZE()

Syntax:      MREPLACE()

Arguments:   None

Returns:     True if all fields successively replaced.

Description: This function is designed to be used in conjunction with the
             MEMORIZE(), CHANGED(), and FORGET() functions; they are all a
             team.  Put together, they simplify the scattering and
             gathering of database field contents into and from associated
             memory variables (some languages call them temporary field
             variables).  What MREPLACE() does is to replace each field in
             the current database record with the associated field memory
             variable that was created with MEMORIZE() and usually,
             recently edited.

Notes:       Memory variables created with MEMORIZE() have the same name
             as their database field counterparts.  Whenever there exist
             fields and memory variables with the same name, fields take
             precedence.  To access these variables you must preface the
             variable name with the memory variable identifier alias M->.

             MREPLACE() does a REPLACE <field> WITH <fieldvar> for each
             field of the database record.

Example:     *-- store field values to memvar copies
             MEMORIZE()

             *-- get the data
             @ 1,0 SAY "Enter full name" GET M->name
             @ 2,0 SAY "Enter birthdate" GET M->birthdate
             @ 3,0 SAY "Enter age      " GET M->age  PICTURE "##"
             *-- remember to always PICTURE numeric memory variables
             READ

             *-- don't bother replacing if no change
             IF CHANGED()
                IF .NOT.  MREPLACE()
                   SAYINBOX("Error writing fields!  Replace failed.")
                ENDIF
             ENDIF

             *-- now release the public variables
             FORGET()

Source:      RL_MREPL.PRG

See also:    CHANGED(), FORGET(), MEMORIZE()

See Also: CHANGED() FORGET() MEMORIZE()

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