PDF version of this page

Formulas

Formula are additional data defined within records. Formula are derived during XML processing.


Two types of formula may be defined, from this window which opens automatically after Add is pressed.

Mathematical formula (number) comprises two types:

  • within record calculations (such as "extension = qty * unit price")

    running totals (to a Variable)

Concatenated/substituted text field (text) is used in two ways:

  • assembly of data into a single field for purposes other than FormTrap formatting (such as Suburb+comma, State and PostCode)

    Substitution lookup value



To define a formula, select the record (Product in this example) from the Document window, then right-click and select Properties ...



... or select from the Record menu.



... or select via Properties.




All selection methods open the Record Properties window. From Properties windows select Formulas, Add, then one of the two options from the pull-down.

Note that formula may produce output with excessive decimals, these are rounded using RegEx when the field is the source for printing

Mathematical formula (number)

Supply Name, then construct the Formula. Formulas can use any of the field names defined for this project, via the Insert into formula ... pull down.

Fields show in the list in this order, then alphabetically:

Operators are any of the set shown (table is reproduced from the web reference).

muParser from sourceforge provides the Mathematical formula functions of FormTrap and may be viewed at http://muparser.sourceforge.net

This formula is for a running total of detail lines, and is a common variable/formula combination:

[master/Running total] = [master/Running total] + [Product/Extended Cost]




You may check the syntax of ...




... and test values for the formula.

Concatenated text field

This allows fields defined as text to be concatenated for later processing, and is used mainly to form "substitution" names where the source field value(s) address the correct entry in the lookup table (alternately for Version 7 compatibility, the substitution file name). The example shows a typical substitution name formed from "Ship To" to bring in the entire address as one Formula field.




Supply Name, then construct the string using constants and fields taken from the Insert ... list.

Fields are enumerated in the list in this order, then alphabetically:

current record
master record
master variable fields
system fields

Fields are placed adjacent and intermediate characters may be keyed, normally spaces or carriage returns




You may view results by keying data values, with ";" following to see the concatenated result.

This is a substitution formula that obtains the staff member name associated with each supplier. Note the supplier number forms part of the data file name.



For Substitution formula, make sure text source fields are Normalized to "Trim" leading and trailing spaces.

Numeric data with leading zeroes should be Normalized to "Remove leading zeros".

Top