GETEXPR Command

Example   See Also

Displays the Expression Builder dialog box so you can create an expression and store the expression to a variable or array element.

Syntax

GETEXPR [cCaptionText] TO MemVarName
  [TYPE cExpressionType [; cErrorMessageText]]
  [DEFAULT cDefaultExpression]

Arguments

cCaptionText

Specifies the caption that appears in the Expression Builder. The caption can be used to remind the user of what kind of expression to build.

TO MemVarName

Specifies the variable or array element in which the expression is stored. If the variable doesn't already exist, Visual FoxPro creates it. GETEXPR won't create an array element.

If you exit the Expression Builder by pressing ESC or by choosing Cancel, the empty string is stored to the variable or array element. If a default expression is created with the DEFAULT clause, the default expression is stored to the variable if you exit the Expression Builder by pressing ESC or choosing Cancel.

TYPE cExpressionType [; cErrorMessageText]

Specifies the expression type. The following table lists the character to specify in cExpressionType for each expression type:

cExpressionType Expression type
C Character
D Date
T DateTime
N Numeric
F Float
I Integer
B Double
Y Currency
L Logical

You can specify the error message cErrorMessageText to be displayed if the expression isn't valid. If cErrorMessageText is included with cExpressionType, cExpressionType and cErrorMessageText must be separated by a semicolon (;). The combination of cExpressionType, the semicolon, and cErrorMessageText must be enclosed in single or double quotes in matching pairs.

DEFAULT cDefaultExpression

Allows you to display the initial default expression in the Expression Builder. You can accept the default expression or overwrite it with your own expression specified with cDefaultExpression. cDefaultExpression is stored to the variable or array element if you exit the Expression Builder by pressing ESC or choosing Cancel.