Expression Builder

Whenever you have to enter an expression, clicking the icon you displays the Expression Builder. The Expression Builder provides access to all the inputs required to build any type of expression:

The Expression Builder provides automatically evaluates every expression and displays the value and data type of result. This prevents you from trying to use an invalid expression. [Picture]

The auto-complete feature helps you with the syntax of Xbasic functions. [Picture]

The "Keyboard" below the editing window provides point-and-click operators, and can be toggled on/off by pressing the Keyboard button on the bottom right.

You can open the Expression Library by clicking the Expression Library button . You can store and retrieve often used expressions in the Expression Library.

The Expression Builder uses "auto-complete" technology to help you write functions. For example, as you begin to type, the Bubble Help shows a list of functions that start with the letters you type. As you type more letters, the list becomes narrowed down. In addition, the Expression Builder shows the syntax for each function, and Alpha Five prompts you for each of the function arguments.

Functions in expressions are color coded so that expressions are easier to read.

Evaluating an Expression

When you evaluate an expression in the Expression Builder, VCR style buttons allow you to evaluate forwards and backwards through the records in the table, and to jump to the beginning or end of the table, or to an explicit record number. In addition, you can display sample values from the fields in the table.

Select Field Name

To insert the name of a table field into an expression.

  1. Position the cursor within the expression.

  2. Double click Field Name or click F2 to display the Select Field dialog box.

  3. Optionally click A-Z to sort the list in ascending or descending order.

  4. Select the field name you want to insert and click Insert.

Select Field Value

To insert the value of a table field into an expression.

  1. Position the cursor within the expression.

  2. Double click Field Value or click F3 to display the Select Field dialog box. The dialog shows up to 100 records from the beginning of the table. [Picture]

  1. Optionally click A-Z to toggle between record number order and a sorted view showing unique keys only.

  2. When showing unique keys, click to toggle between ascending and descending order.

  3. Optionally, click to show the first, previous, next, or last 100 records in the table.

  4. Optionally, click to display the Jump To dialog box. Enter a record number and click OK to display the 100 records starting with the specified record number.

  5. Select the field name you want to insert and click Insert.

Select Function

To insert a function into an expression.

  1. Position the cursor within the expression.

  2. Double click Function or click F4 to display the Function Finder dialog box.

  3. Select the function and click Insert.

Select Calculated Field

To insert a calculated field into an expression.

  1. Position the cursor within the expression.

  2. Double click Calculated Field or click F5 to display the Select Calculated Field dialog box.

  3. Optionally click A-Z to sort the list in ascending or descending order.

  4. Select the calculated field and click Insert.

Select Variable

To insert the name of an existing variable into an expression.

  1. Position the cursor within the expression.

  2. Double click Variable or click F6 to display the Select Variable dialog box.

  3. Select the scope of the variable in the Category list.

The available categories will depend on the context in which the expression builder is invoked. However, all contexts will have these contexts:

A global variable is visible throughout Alpha Five. For example, if the variable is defined by a script in one form, then any other form in your Alpha Five session has access to that variable.

A session variable is visible throughout an Alpha Five session. A session is created when you open a new window in Alpha Five (e.g. a new form, or browse window). All scripts on a form, for example, have access to a session variable. If you swap the layout displayed in a window (for example, by pressing the F8 key while viewing a form, to switch to a browse view), session variables remain visible to the new layout displayed in the window (because it is still the same session).

If the Expression Builder is invoked from within a Layout, then the Layout category is available.

A Layout variable is visible to all scripts and expressions in a form, but if the Layout in the window is swapped (for example, by opening a new form in the same window, or switching to a browse view), then the Layout variables are no longer available.

  1. Select the variable you want to insert from the Variable list and click Insert.

Select System Field

To insert the name of a system field into an expression.

  1. Position the cursor within the expression.

  2. Double click System Field or click F7 to display the System Fields dialog box.

  3. Select the field and click Insert.

Select Library Entry

To insert an expression from a library into an expression.

  1. Position the cursor within the expression.

  2. Double click Library Entry or click F9 to display the Expression Library dialog box.

  3. Select the expression and click Insert.

See Also

Writing Expressions