Expression Builder Dialog Box

Makes it possible for you to create and edit expressions. An expression can be as simple as a field name or as complex as a calculation involving immediate IF functions, concatenations, and data type conversions. The main purpose of the ExpressionBuilder is to facilitate the creation of expressions by providing you with lists of appropriate options each step of the way. This dialog box can be accessed from designers, windows, builders, and wizards.

To create an expression, you can type it directly into the expression box, or you can select items from the functions drop-down lists in the dialog box to have Visual FoxPro paste them into the expression box for you.

You might find some of the following functions useful when manipulating strings in expressions.

If you want to Use this function
Remove leading and trailing blanks from character expressions ALLTRIM( ) Function
Remove leading blanks LTRIM( ) Function
Remove trailing blanks RTRIM( ) Function
Add specified characters to the left, right, or both sides of a string PADL( ) | PADR( ) | PADC( ) Functions
Work with parts of a character string for comparisons SUBSTR( ) Function
Use a specified number of characters starting with the left of a string LEFT( ) Function
Use a specified number of characters starting from the right of a string RIGHT( ) Function
Change uppercase to lowercase, or lowercase to uppercase UPPER( ) Function, LOWER( ) Function
Convert a string to initial capitals PROPER( ) Function
Have a numeric field interpreted as a character string STR( ) Function

Functions

Contains list boxes of four function types. When you select a function from one of the four types, Visual FoxPro automatically pastes it into the expression box. When you are building expressions for remote views, Visual FoxPro lists only the functions specific to the target back-end data.

  • String
    Lists available character string functions.

  • Logical
    Lists available logical functions.

  • Math
    Lists available math functions.

  • Date
    Lists available date and time functions.

  • Expression
    Displays the expression that you are creating or editing.

  • Fields
    Lists the fields in the current table or view.

    To paste a field into the Expression box, either double-click the field or select the field and press ENTER.

    To display fields from a different table, select a different table in the FromTable box.

  • From Table
    Lists tables and views that are open. Select a table or view to update the Fields box.

  • Variables
    Lists system memory variables, arrays, and memory variables that you have created.

    To paste a variable into the Expression box, either double-click the variable, or select the variable and press ENTER.

  • Verify
    Validates the syntax of the expression in the expression box if the corresponding table is open. If the expression is valid, "Expression is valid" is displayed in the status bar. If it is not valid or if the corresponding table is not open, Visual FoxPro displays an error message. This option is not enabled for remote views.

    Note   If you include a user-defined function call in the expression, Verify will indicate an error, but there will not necessarily be an error when the expression is evaluated at run time.

  • Options
    Displays the Expression Builder Options Dialog Box, in which you can set preferences for the ExpressionBuilder.

For more information, see "Building Print Expressions" in Setting Each Control's Print Options.

See Also

ALLTRIM( ) Function | Expression Builder Options Dialog Box | IIF( ) Function | LEFT( ) Function | ISLOWER( ) Function | ALLTRIM( ) Function | PADL( ) | PADR( ) | PADC( ) Functions | PROPER( ) Function | RIGHT( ) Function | RTRIM( ) Function | SET ANSI Command | SET EXACT Command | STR( ) Function | SUBSTR( ) Function | UPPER( ) Function