The formulavariables( function returns a list of variables used in a formula.


This function has two parameters:

database – the database the formula is associated with. If this is omitted or is "", the current database is assumed.

formula – is the formula to be analyzed. If the formula is specified inline in the function itself, it must be quoted (see Quotes). Otherwise, you can pre-store the formula in a field or variable.


The function returns a list of identifiers (fields and variables) used in a formula. The list is returned as a carriage return delimited text array.

For example,


will return the two variables that appear in this formula:


Note that this function doesn’t check to see if the variables actually exist. It simply analyzes the text of the formula to produce the list. Here is one way you could check the list for undefined variables.

let items = formulavariables({alpha+cr()+bravo+sqr(Price)+upper(Name)})
looparray items,cr(),item
    let itemtype = catcherror("",datatype(item))
    if itemtype = ""
        message item+" does not exist."

If the formula is associated with a different database (not the current database), you must explictly specify the database, like this.

formulavariables("Mailing List",{alpha+cr()+bravo+sqr(Price)+upper(Name)})

Note: You may wonder why the function needs to know the name of the database, since it is returning a list of variables, not fields. It needs this because it starts by getting a list of all identifiers in the formula (see formulaidentifiers(), and then removes the fields from the list.

See Also


10.2NewCarried over from Panorama 6.0