formulacalc
RESULT
,
FORMULA

The formulacalc statement allows you to evaluate a formula that you were not able to code into the procedure when it was being written.

Parameters

This statement has two parameters:

result – must be the name of a field or a variable where you wish the result of the formula to be placed. The formula’s resulting value must match the type and format (if any) of result or an error alert dialog will be displayed. If a field is specified it must be in the current database, even if you have specified that the formula be calculated using a different database.

formula – is the formula to be calculated. Unlike an assignment statement, the formula is contained in a formula, allowing you to change the formula on the fly. If the formula doesn’t need to be changed you must enclose it in quotes, otherwise you can store the formula in a variable.

Description

This statement calculates the result of a formula. This statement allows you to:

• Specify what database is to be used for the calculation.
• Change the formula on the fly.
• Does not stop if there is an error.

To find out if an error occurred you must check the info(“error”) function.

This simple example allows the user to enter a calculation to be performed using a Checkbook database.

``````local myFormula,myResult
gettext "Enter Formula:",myFormula
formulacalc myResult,myFormula
message myResult
``````

• Arithmetic Formulas -- mathematical operators and functions.
• Characters and Unicode Values -- working with individual characters of text.
• Constants -- values embedded into a formula.
• convertvariablestoconstants -- converts all of the variables in a formula into constant values.
• Date Arithmetic Formulas -- performing calculations on dates, and converting between dates and text.
• Formula Workshop -- formula workshop wizard for testing and experimenting with formulas.
• formulafields( -- returns a list of fields used in a formula.
• formulaidentfiers( -- returns a list of identifiers (fields and variables) used in a formula.
• Formulas -- basics of formulas: components and grammar.
• formulavalue -- calculates the result of a formula. Usually this is done with an assignment statement (for example `x=2 * y` ), but the *formulavalue* statement gives you more flexibility. You can specify what database is to be used for the calculation (an assignment statement always uses the current database) and you can specify the formula using a variable, making it easy to change on the fly. This statement also gives you more control over how errors are handled.
• formulavariables( -- returns a list of variables used in a formula.
• Functions -- index of all functions available for use in Panorama formulas.
• Linking with Another Database -- techniques for relating multiple database files so that they work together.
• makemergeformula( -- builds a formula from an “auto-wrap" style merge template.
• Non Decimal Numbers -- working with numbers in alternative (non-decimal) bases, including binary, octal and hexadecimal.
• Numbers -- Working with numeric values in a formula, and converting between numbers and text.
• Operators -- index of all operators available for use in Panorama formulas.
• Quotes -- text constants embedded into a formula
• Statements -- index of all statements available for use in Panorama procedures.
• SuperDates -- date and time combined into a single value.
• Tag Parsing -- Panorama functions for working with text that contains data delimited by tags, including HTML.
• Text Formulas -- manipulating text with a formula (concatenation, extraction, rearranging, etc.)
• Time Arithmetic Formulas -- performing calculations on times, and converting between times and text.
• True/False Formulas -- logical boolean calculations.
• Using Fields in a Formula -- accessing database fields within a formula.
• Values -- the raw material that formulas work with -- numbers and text.
• Variables -- storing and retrieving individual items of data, not part of a database.

History

 Version Status Notes 10.0 No Change Carried over from Panorama 6.0.