Formula - formula expression

 

Help with building a formula

 

The dialog is used for creating / editing numeric or string formula.

 

It can be accessed by the  button in the following places:

 

            Part library - Length / Width fields

            Product library - Width / Height / Depth / Vertical position & Price fields

            Machining library - most instruction fields

 

Or by pressing F2 or the small button in the grid in the following places:

 

            Formulae table - Formula grid column

            Cutting list rules - value grid column

            Board list rules - value grid column

 

When the facility is selected the dialog will appear as follows:

 

 

The type option is used to select either a numeric or string based formulae. Note - String based formulae is only applicable for fields that accept a string (e.g. Cutting list and board list rules).

 

The help view button opens the help window at the side of the dialog.

The Fx button is used to select and add an existing formula to the current formula.

The @ button is used to select and add a variable name to the current formula.

The $ button is used to select and add a look-up to the current formula.

 

The large edit box is where the formula is entered. If an existing formula is being edited, then the existing formula text will appear here.

 

When the focus is on the large edit box, if the mouse moves part a valid function name, then that function and its arguments will be displayed in the Function arguments box below the large edit box as well as the relevant help page in the window at the side of the dialog.

 

e.g. If the mouse is over RIGHT for a string formula then the Function arguments box would show

 

      RIGHT (string, number of characters)

 

If the type Numeric is selected then it must obey the rules for the expression and general mathematics (see the help section on Formula for details).

 

- Enter the details of the formula expression in the 'formula'. For example:-

 

=X-(2*T(@CARCASEMATERIAL@))

 

Evaluated answer

 

The evaluated answer section will display the answer to the current formula. If the formula is not complete then Error will be displayed

 

e.g. If a numeric formula is =10+

 

If a formula is complete then the answer will be displayed

 

e.g. The answer would be 15 if a numeric formula was set to =10+5

 

If a formula is valid, but one or more of the elements within the formula are unknown at the current time (e.g. X or a variable answer), then the following message is displayed:

 

      Unable to evaluate

 

E.g. =X+@MATVAR@ would display that message.

 

Functions

 

The functions list box is used to show all the available functions that can be used in a formula.  The list is different depending on whether the formula type is numeric or string.

 

Left clicking on a function will display the arguments in the Function arguments box.

 

Double clicking on a function will add that function to the formula at the current caret position.

 

Fields

 

The field list box is used to show all the available fields that can used at the formula. The fields are only available for cutting list and board list rules.

 

Double clicking on a field will add that fields to the formula at the current caret position.

 

Variables

 

To evaluate a formula that contains variables, the variable and answer need to be entered into the variables grid.

 

Note - the answers entered here are just to check the formula is constructed correctly. Different answers may be used when the formula is used across the package.

 

A variable can be added to the grid in one of three ways:

 

- by manually entering a variable name in the first column.

- by using the button in the grid column to select a variable from the variable table.

- by using the @ button in the top right corner of the dialog. This will add the variable name to the existing formula and add it to the variable grid.

 

If a variable has a default answer in the variable table, it will be placed in the answer grid cell next to the variable.

 

If the formula dialog is closed and re-opened inside an application, the previously entered variables/answers will be re-shown.

 

Additional

 

Two new functions are available called AND and OR.

 

The AND is used to check if two values are true and continue accordingly.  The format is x AND y.

 

e.g. The machining library instruction On/Off field could be defined as:

 

            =X>=200 AND X<=300

 

So this instruction will only be on if the part length is between 200 and 300.

 

The OR follows the same format, but will return true if either value is correct.

 

      e.g. =X<800 OR Y<600

 

This is true is the X is smaller than 800 or the Y is smaller than 600.

 

 

Notes

 

- Start each formula with =

 

- When entering formula from the table in the product library or part drawings identify the formula with the character &, for example: &DOORPOSITION&

 

- The maximum nesting for a formula is 10 deep Nesting is where one formula includes another, for example, if the following formulae are set up:-

 

&ADDTHK& =Z/2+3+&PLINTH&

&PLINTH& =X/3-200

 

The formula &ADDTHK& is the same as: Z/2+3+(X/3-200)

 

- A variable cannot contain a formula definition, so the following variable is not allowed: @VAR&THICK&IBLE@

 

 

See also