formulavalue(
DATABASE
,
FORMULA
)

The formulavalue( function calculates the result of a formula based on data in the current record of any open database. This is similar to the fieldvalue( function, but allows any formula to be used, rather than just a single field.


Parameters

This function has two parameters:

database – is the database that you want to grab data from. This database must be currently open. If this parameter is "" or omitted then the current database will be used.

formula – is the formula to be used to retrieve data. 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.


Description

The function returns data from the specified database. This is similar to the superlookup( function, but the formulavalue( function does not search for the data, it simply uses whatever data is in the currently active record of the specified database.

This example grabs the current address from a Mailing List database, in mailing label format.

formulavalue("Mailing List",{First+" "+Last+cr()+Address+cr()+City+", "+State+
    " "+Zip+sandwich(cr(),Country,"")}

If you want to evaluate the formula based on the current database, you can omit the database parameter, like this:

formulavalue({First+" "+Last})

You may wonder why you would ever do this, since the formula above could more simply be calculated like this:

First+" "+Last

The benefit of the formulavalue function is that it allows the formula to be changed on the fly, perhaps stored in a field or variable.

letfileglobal nameFormula = {First+" "+Last}
...
...
...
message formulavalue(nameFormula)

Now the calculation can be modified at any time, or even edited with a Text Editor Object.


See Also


History

VersionStatusNotes
10.2UpdatedThe database parameter can now be omitted if you want evaluate the formula based on the current database.
10.0NewNew in this version.