Share via


Name Expression Creation

Many Visual FoxPro commands and functions require that you supply a name. Although a name cannot be a variable or an array element, you can create a name expression that substitutes the value of a Character variable or array element as the name.

When you store the name to the variable or array element, you can substitute the name into a command or function by enclosing the variable in parentheses. To use a list of names, separate the names with commas. A name is not an expression, a variable or array element, or a field. A name should not be surrounded by quotation marks. Otherwise, names follow the Visual FoxPro naming rules described in the section Creating Visual FoxPro Names.

For example, the REPLACE command requires a field name. You can store a field name to a variable and use a name expression in REPLACE where the field name occurs:

STORE 'city' TO cVarCity
REPLACE (cVarCity) WITH 'Paris'

Visual FoxPro stores the field name city to the variable cVarCity, then stores the value "Paris" in the field, city, which is the value of the name expression cVarCity.

For more information, see STORE Command and REPLACE Command.

See Also

Concepts

Macro Substitution (Visual FoxPro)

Creating Visual FoxPro Names

Other Resources

Building Expressions