A formula is a set of instructions, which the program can evaluate and use to perform calculations and process or transform textual content. Many objects have the ability to contain and evaluate formulas.
For example, formulas used with notes (AMNOTE command) provide the intelligence for notes to show the most appropriate note text, depending on the context. In the BOM, the program uses formulas to perform mathematical calculations and fill in BOM columns automatically.
If the result of a formula is a text, the formula typically contains a sequence of expressions and text strings. If the result of the formula is a numeric, the formula contains only an expression.
Examples of formulas that return a numeric result:
Examples of formulas that return a textual result:
Note the following:
In text formulas, the program evaluates expressions only if they are between angle brackets. Anything outside brackets is interpreted as literal text.
Expressions can contain numbers, functions, references, and mathematical operators. Example 1, previous, contains numerics and mathematical operators. Example 2 contains the references QTY and PRICE, which refer to the quantity and the prices of a BOM item. Example 3 contains the function PI().
References
A reference identifies a property of an object and tells a formula what data to get and use. For example, the reference STDP:STD refers to the name of the standard part. If a note contains the formula =<STDP:STD>, when the note is attached to an ISO M5X35 countersunk screw, the formula renders <STDP:STD> to the text “ISO 2009 M5 X 35” and shows it as part of the note text. If you change the length of the screw, the formula ensures that the note text changes to reflect the new length.
The types of references that you can use in formulas are:
Please see the reference tab for a detailed description of these variables.
Functions
A function is a predefined formula. If you specify input values, called arguments, the function processes them and return the result. For example, the formula =INT(QTY*PRICE), uses the function INT. INT uses the product of QTY (Quantity of a BOM item) and PRICE (The unit price of a BOM item) as arguments. It returns the rounded down value of QTY x PRICE, to the nearest dollar.
The expressions in the previous example are not enclosed within angle brackets because the formula returns a numerical value and not a text value.