Allows 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 Expression Builder 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( ) |
Remove leading blanks | LTRIM( ) |
Remove trailing blanks | RTRIM( ) |
Add specified characters to the left, right, or both sides of a string | PADL( ), PADR( ), PADC( ) |
Work with parts of a character string for comparisons | SUBSTR( ) |
Use a specified number of characters starting with the left of a string | LEFT( ) |
Use a specified number of characters starting from the right of a string | RIGHT( ) |
Change uppercase to lowercase, or lowercase to uppercase | UPPER( ), LOWER( ) |
Convert a string to initial capitals | PROPER( ) |
Have a numeric field interpreted as a character string | STR( ) |
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 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.
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 Expression Builder.
For more information, see "Building Print Expressions" in Chapter 12, Adding Queries and Reports, in the Programmer's Guide.