Predefining Your Own Formulas

You can create your own predefined formulas with the System page.

To access the System page, select the Tools menu. Then click the System Setup menu item. When the third-level mega-menu appears, click More. On the result page, click System link. Then click Formula on the System page. The Formula result page displays a list of formulas with the following columns:

  • Formula Name
  • Formula Desc (Description)
  • Formula Declaration
  • Formula Expression

To add a new predefined formula, click the Add action on the Formula section bar. This causes a form to pop up like the following:

(a) General

  • Formula Name
  • Formula Desc
  • Formula Expression

(b) Formula Parameters (with section actions: Existing Formulas | Quick Add | Delete)

  • Parameter Position | Parameter Name

To see how to fill in this form, we will work through an example. The example that we will work through will be a formula named diagonal that computes the length of a rectangle’s diagonal, given the rectangle’s width and height.

Having the diagonal of a rectangle as a formula allows computing the diagonal length of a room without having to store the result in a field. We will be able to use it in extended formulas by writing something similar to diagonal(width,length).

If you do not actually need to store a value that is simple to compute, it is usually better to compute the value.

To define the predefined formula diagonal, fill in the form as shown below:

(a) General

  • Formula Name: diagonal
  • Formula Desc: Compute the length of a rectangle’s diagonal.
  • Formula Expression: sqrt(width*width+height*height)

(b) Formula Parameters (with section actions: Existing Formulas | Quick Add | Delete)

  • Parameter Position | Parameter Name
  • 1 | width
  • 2 | height

In the General section, type the name of the formula into the Formula Name field. Type the description of the formula into the Formula Desc field. Type the text of the formula into the Formula Expression field. There are two things to notice about the formula text in this example:

  • The formula uses sqrt, which is a system formula. Predefined formulas also can use other predefined formulas. To see a list of available predefined formulas, click the Existing Formulas action on the Formula Parameters section bar.
  • The formula uses the names width and height. These are not inputs. They are something else called formal parameters. A formal parameter is a name of a value that is used within a predefined formula. Formal parameters are not directly associated with values. What they are directly associated with are input positions.

The Formula Parameters section associates the formal parameter width with the position 1. It also associates the formal parameter height with the position 2. This means that if in an extended formula someone writes diagonal(7,9), the predefined formula diagonal will be computed with width equal to 7 and height equal to 9. This is because width gets the value in position 1 and height gets the value in position 2.