Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>replace</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
REPLACE


Syntax:     REPLACE [<scope>] [<alias>->]<field1> WITH <exp1>
            [,<field2> WITH <exp2>,...] [FOR <condition>] [WHILE
            <condition>]

Purpose:    To change the contents of fields to the results of specified
            expressions.

Arguments:  <field> is the name of the target field to change.  This
            can be a field of any type including memo.  There is one
            target field per WITH clause.

            <exp> is the replacement expression.

Options:    Alias: Fields in other work areas can be REPLACEd by
            preceding the field name with the alias.

            Scope: The <scope> is the portion of the current
            database file to REPLACE.  The default is the current
            record.  Specifying a condition changes the default to ALL
            so that every record is tested for the specified condition.

            Condition: The FOR clause specifies the conditional set
            of records to REPLACE within the given scope.  The WHILE
            clause specifies the set of records meeting the condition
            from the current record until the condition fails.

Usage:      Be aware that when you REPLACE a key field, the index is
            updated and the relative position of the record pointer
            within the index is changed.  This means that REPLACEing a
            key field with a scope or a condition will yield an
            erroneous result.  If this is necessary, SET ORDER TO 0
            before the REPLACE.  Alternately, you may CLOSE INDEX,
            perform the REPLACE, SET INDEX TO the appropriate index
            files, and then REINDEX.

            Memo fields: Since Clipper supports the manipulation of
            memo fields in the same way as character fields, you can
            REPLACE a memo field with a character string.

Network:    In a network environment, REPLACEing the current record
            requires an RLOCK().  REPLACEing several records requires an
            FLOCK() or EXCLUSIVE USE of the current database file.  If a
            field is being REPLACEd in another work area by specifying
            its alias, that record must also locked with an RLOCK().

Library:    CLIPPER.LIB


----------------------------------- Example --------------------------------

   SELECT 1
   USE Customer
   APPEND BLANK
   SELECT 2
   USE Invoices
   APPEND BLANK

   REPLACE Charges WITH Customer->Markup * Cost,;
      Custid WITH Customer->Custid,;
      Customer->Last_tran WITH DATE()



See Also: APPEND COMMIT JOIN SET ORDER UPDATE STRTRAN()

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