Share via


Expression Builder Dialog Box

Makes it possible for you to create and edit expressions. The Expression Builder provides lists of appropriate options and can be opened from various designers, windows, builders, and wizards.

To create an expression, type it into the Expression box or select items from the Functions lists. An expression can be simple, such as a field name, or complex, such as a calculation involving IIF( ) functions, concatenations, and data type conversions.

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

    Tip

    You can enter more than 255 characters as well as extended characters, such as CHR(13) (carriage return) and CHR(10) (linefeed), for expressions in the Expression Builder. The Expression box in the Expression Builder supports color syntax and background compilation when turned on. For more information, see How to: Display and Print Source Code in Color.

    Warning

    Property values that exceed 255 characters or include extended characters contain padding with CHR(1) characters. However, classes in visual class library (.vcx) files that contain properties with such values cannot be used in versions prior to Visual FoxPro 9.0. If you attempt to modify these classes in a prior version, an error occurs. You can still use other classes in the same visual class library (.vcx) files with previous versions of Visual FoxPro as long as they do not contain property values exceeding 255 characters or include extended characters.

  • Functions
    Displays lists of 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.

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

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

    To display fields from a different table, select a different table in the From Table 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.

    Warning

    If you include a user-defined function call in the expression, an error is indicated; however, an error does not necessarily occur when the expression is evaluated at run time.

  • Options
    Displays the Expression Builder Options dialog box, which you can use to set preferences for the Expression Builder. For more information, see Expression Builder Options Dialog Box.

The following table describes some useful functions for 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

See Also

Reference

IIF( ) Function

ISLOWER( ) Function

SET ANSI Command

SET EXACT Command

Other Resources

Dialog Boxes (Visual FoxPro)