Xbasic

# A5_EVAL_EXPRESSION Function

Syntax

OutputString as C = a5_eval_expression(C expression [,* vars ])

Arguments

expression

An Xbasic expression.

vars

*

Description

Used in code generated by the Script Genie. If expression starts with = then it evaluates it as an expression in the context of the current form.

Discussion

The A5_EVAL_EXPRESSION() function evaluates an expression in the context of the current form or browse window. Used extensively in the code generated by the Script Genie. In the Script Genie, in many of the places where you can specify a constant value, (such as the title of a dialog box), you can also specify an expression by simply preceding the value that you specify with an = sign.

### Example

For example, "Show Selections" is a constant value, while =dlg_title signifies that the value should be obtained by evaluating the expression dlg_title. If dlg_title is a field on the current form, then a5_eval_expression("=dlg_title") returns the value in the dlg_title field. On the other hand a5_eval_expression("Alpha Anywhere") returns the constant value "Alpha Anywhere". The following example shows how to open an image (or any other file type, such as a PDF file) with its Windows associated application. The image's path and name are stored in an ordinary character field named " fileloc ". Put this code under the OnPush event of a button.

```DIM filename as C
filename = a5_eval_expression("=Fileloc")
if file.exists(filename) then
sys_open(filename)
else
ui_msg_box("Error Opening File", "File '" + filename + "' does not exist.", ui_stop_symbol)
end if```

Limitations

Desktop applications only.