@Eval (Formula Language)

At run-time, compiles and runs each element in a text expression as a formula. Returns the result of the last formula expression in the list or an error if an error is generated by any of the formula expressions in the list.

Note: This @function is new with Release 6.

Syntax

@Eval( textExpressions )

Parameters

textExpressions

Any text expressions that you want @Eval to evaluate. Surround the text expression to be evaluated with braces ({ }) or quotation marks (" "). If you use quotation marks, escape quotes around individual text expressions within the formula with back-slashes (\). If you use braces, escape the right brace. Use the plus sign (+) to concatenate text expressions.

Return value

lastExpression

The value of the last expression.

Usage

This function is useful in agents, hotspot buttons, and toolbar buttons and when you want to evaluate multiple text expressions at run-time from within a single @function.

Use of @Eval in view columns and selection formulas may produce unexpected results. Because this function is evaluated at run-time, the view engine is unable to follow its standard procedure of analyzing the formulas ahead of time to discover what types of @functions it will encounter and prepare for them.

Examples

  1. This formula concatenates the value of the temporary variable x and the text expression "bar." It returns "rebar."
    x := "re";
    @Eval({x + "bar"});

  2. The following code, when added to an action button, creates the field "comment" and adds the user's input to it on the fly.
    input := {FIELD comment := @Prompt([OKCANCELEDIT];"Input";"Input a value"; "Default");};
    @Eval(input);

    To view the content of the comment field, use the following code in a hotspot or action button.

    @Prompt([OK];"Value of comment field";@GetField("comment"))