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

Purpose:     Release field memory variables created with MEMORIZE().

Syntax:      FORGET( [ firstfield [, lastfield ] ] )

Arguments:   firstfield  - Optional numeric value indicating the first
                           field in the database whose PUBLIC M-> copy
                           variable is to be RELEASEd.  The default is
                           field number 1.

             lastfield   - Optional numeric value indicating the last
                           field in the database whose PUBLIC M-> copy
                           variable is to be RELEASEd.  The default is the
                           last field, FCOUNT().

Returns:     True (.T.) if all fields were successively released.

Description: This function is designed to be used in conjunction with
             CHANGED(), MEMORIZE(), and MREPLACE(); they are all a team.
             Put together, they simplify the tedious task of making memory
             variable copies of each field in a database record (some
             languages call them temporary field variables).  FORGET() is
             used to release the PUBLIC variables created by MEMORIZE(),
             when your editing and REPLACEing is finished.

Notes:       Since variables created with MEMORIZE() are declared PUBLIC,
             FORGET() releases them to reclaim memory and to avoid any
             potential name conflicts.  Some programmers save field values
             to memory variables with a common prefix (like m_), and when
             they are finished with them do a RELEASE ALL LIKE m_*.  This
             is fine if the variables are released in the same procedure
             in which they were created.  However, it is more efficient to
             do this storing in a sub-procedure, hence the need to make
             these variables PUBLIC.  The problem is that in Clipper, you
             cannot RELEASE ALL LIKE m_* if the m_* variables are PUBLIC
             variables that were created in another procedure.  FORGET()
             takes care of all this by explicitly naming each variable to
             be RELEASEd, which is the only way you can release a PUBLIC
             variable created in another procedure.

             FORGET() uses the field definitions in the currently selected
             database to create the PUBLIC variable names to release.  If
             no database is open in the current select area, FORGET() will
             return .F.  and set the appropriate RLIBERROR().

Example:     *-- store empty field values for a new record
             MEMORIZE(.T.)

             *-- 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

             *-- now add the new record and put in the data
             IF NO_APPEND()
                SAYINBOX( "R/W", "Append failure, record not saved!" )
             ELSE
                MREPLACE()
             ENDIF

             *-- now release the public variables!
             FORGET()

Source:      RL_FORGE.PRG

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

See Also: CHANGED() MEMORIZE() MREPLACE()

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