EVAL

This command returns the result of the specified formula, formatted as a string.  

The EVAL command allows you to build formulas dynamically and then execute them. You can also use it to create a formula in one cell and execute the formula in other cells.

Note: The cell references inside the text for a EVAL command are not updated the way a cell reference usually is (for example, when a column is added to the template.) That is because the text for the EVAL is just text.

Syntax

EVAL "formula_string"

The "formula_string" must be a valid template formula. It may include multiple commands that are separated by a colon (:).

Return value

This command returns a string.

Notes

Important: GainSeeker cannot check the syntax of your "formula_string" until you run the template.  Therefore, you should use extra caution when creating and testing templates that use the EVAL command.

If the "formula_string" generates a syntax error when you run the template, the EVAL command will:

 return an empty string

 set the value of a variable named MySVar "Eval_Error" to equal the error message

If no syntax error is generated, the EVAL command will set the value of MySVar "Eval_Error" to an empty string.

To convert the string value returned by the "formula_string" to a numeric value, use the VAL command.

Examples

formula in cell [A1]:   MySVar "ValueCheck" = "ABS (NOMINALSPEC - [D1])"
formula in cell [E1]:   EVAL MySVar "ValueCheck"

The formula in cell [E1] returns the difference between the Nominal Spec and the numeric value of cell [D1], formatted as a string.

formula in cell [A1]:   MySVar "ValueCheck" = "ABS (NOMINALSPEC - [D1])"
formula in cell [E1]:   IF (VAL EVAL MySVar "ValueCheck") > 0.5, (MESSAGE "Check the value"), GOTO [D2]

The VAL command returns the numeric value of a string, so the formula in cell [E1] compares the outcome of MySVar "ValueCheck" (the difference between the Nominal Spec and the numeric value of cell [D1]) with the number 0.5.  

 If the numeric outcome of MySVar "ValueCheck" is greater than 0.5, this formula displays a message.

 If the numeric outcome of MySVar "ValueCheck" is not greater than 0.5, this formula directs the template to go to cell [D2].