FoxPro Expression Builder Introduction

Visual FoxPro expressions combine data and operators to create a value with a specific data type. For additional information, visit msdn.microsoft.com and search for Visual FoxPro Expression Builder.

The 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. Refer to Validation Clause Expressions for details regarding Validation Clause Expressions and Scan Set Validation Expressions.

 

To create an expression, type it into the File Name Creation 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.

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.

  • File Name Creation Expression displays the expression that you are creating or editing.

  • 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 backend 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.

Options displays the Expression Builder Options dialog box, which you can use to set preferences for the Expression Builder.

 

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