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


Syntax:        <alias>-><field>/<alias>->(<exp>)

Type:          Alias

Operands:      <alias> is the name of the unselected work area to
               access.  <Alias> must refer to a work area with a
               database file in USE or can be a letter in the range of
               A-J.

               Note: The "M" alias forces the reference to a memory
               variable name instead of a field name.  This is useful
               where there are conflicts between field and memory
               variable names.  Remember that a reference to a variable
               identifier not prefaced with an alias defaults to a field
               if there is both a field and memory variable with the
               same name.  To override this, use the (-v) option when
               compiling.

               <field> is the name of a field in the <alias> work
               area.

               <exp> is an expression of any data type to be
               executed in the <alias> work area.  If this operand is
               not a field reference, it must be bounded by parentheses
               (()).

Description:   The alias operator (->) is used to access field
               information or expression evaluations from unselected
               work areas without executing a SELECT statement first.
               It has the following general uses:

               . Access information from unselected work areas within
                 expressions

               . Access environmental information from unselected work
                 areas

               . Access information from unselected work areas in modes
                 such as REPORT and LABEL FORMs

               . Contributes to the brevity of code

               The alias operator works by implicitly SELECTing the
               <alias> before evaluating the <field> or <exp> operand.
               When the evaluation has placed its return value on the
               stack, the original work area is re-SELECTed, and control
               returns.


----------------------------------- Examples -------------------------------

   USE Customer
   SELECT 0

   ? Customer->Cust_name                && Result: Bill Smith
   ? Customer->(RECNO())                && Result: 1
   ? Customer->(FOUND())                && Result: .F.

   ? Customer->(City + ", " + State + ;
               "  " + Zip)              && Result: ShadowVille, CA  90415


   The following example demonstrates the use of a user-defined function
   (Seek()) as an operand of the alias operator for a common operation
   the normally requiring a greater number of statements:


   IF Invoices->(Seek(cust_num))
     <process customer>...
   ELSE
     <process no find>...
   ENDIF
   RETURN


   FUNCTION Seek
   PARAMETER search_exp

   SEEK search_exp

   RETURN (FOUND())


See Also: Clipper Compiler

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