[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
+---------------------------------+
|             GETEXPR             |
+---------------------------------+
GETEXPR [<expC1>] TO <memvar>
        [TYPE <expC2> [; <expC3>]]
        [DEFAULT <expC4>]

-----------------------------------
Creates an expression and saves it to a memory variable.
-----------------------------------

The GETEXPR command displays the FoxPro Expression Builder.  This allows
you to create an expression and store the expression to a memory
variable.  If the memory variable does not exist when this command is
executed the variable is created.  The expression that is created with
the Expression Builder is stored as a character string.  If the
Expression Builder is exited by pressing Esc or by choosing Cancel, the
null string is stored to the memory variable.  If a default expression
has been defined with the DEFAULT <expC4> option, the default expression
is stored to the memory variable if the Expression Builder is exited
with Esc or Cancel.

Clauses
-------

<expC1>
        The optional argument <expC1> is a message that appears in the
Expression Builder.  This message may be used to remind you what kind of
expression to build.

TO <memvar>
        Memory variable used to store expression.

TYPE <expC2> [;<expC3>]
        The optional TYPE argument lets you specify the type of expression to
be built.  The type of expression to be built is denoted by a single
letter in <expC2> -- C for character, N for numeric, D for date and L
for logical.  You can optionally include an error message to be
displayed if the expression is not valid.  The error message is
specified by <expC3>.

        If <expC2> is used by itself, it must be enclosed in quotes.  If
<expC2> is used with <expC3>, they must be separated by a semi-colon,
and the combination of <expC2>, the semi-colon and <expC3> must be
enclosed in quotes.

DEFAULT <expC4>
        The optional DEFAULT <expC4> lets you specify a default expression to
be initially displayed.  The default expression may be accepted or you
may overwrite it with your own expression.

+---------------------------------+
|         Program Example         |
+---------------------------------+
In this example, GETEXPR is used to get a LOCATE expression from the
user.  If the LOCATE is successful the company name is displayed;
otherwise a message is displayed.

IF USED('customer')
        SELECT customer
ELSE
        USE LOCFILE('customer.dbf','DBF','Where is CUSTOMER.DBF?')
ENDIF
GETEXPR 'Enter condition to locate ' TO temp;
        TYPE 'L' DEFAULT 'COMPANY = " "'
LOCATE FOR &temp
IF FOUND()
        ? 'Company: ' + company
ELSE
        ? 'Condition ' + temp + ' was not found '
ENDIF
USE

-----------------------------------

See Also:  GETFILE(), PUTFILE()

-----------------------------------

See Also: GETFILE() PUTFILE()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson