You are here: Building Expressions > Expression Builder > Using the Expression Builder

Using the Expression Builder

Use the Expression Builder to create or edit ad-hoc expressions, filters, variables and single-value computed fields.

1. Display the Expression Builder by doing one of the following:
Click [Expression] in a dialog.
Click [Edit View Filter] in the View.
Select Edit from the menu, choose Variables and click [New].
Select Edit from the menu, choose Filters and click [New].
Select Edit from the menu, choose Table Layout and click [Add a New Expression].

Note: The method you use to display the Expression Builder determines the type of expression you can build.

2. Build the expression by choosing items from the various list boxes, clicking operators and typing values as required. Double-click to choose an item in a list box.
3. Click [Validate] to check the validity of the expression you entered. A message advises that the expression is either valid for use in Analyzer or invalid.
4. If this is an expression you want to use again, enter a name in the Save As text box. This is particularly useful in avoiding the need to rebuild complex expressions. Unnamed expressions are not saved.
5. Click [OK] to create the expression and close the Expression Builder. The name of your expression is copied into the text box from which the Expression Builder was accessed. If you did not name the expression, the entire expression is copied.

Building Expressions

When building expressions, keep the following guidelines in mind.

Using Functions in Expressions

You can select functions by double-clicking the function name in the function drop-down list. Analyzer displays all the functions alphabetically by default. You can click the arrow beside the functions drop-down list to display all the function categories. If you select a category from the list, only functions of the selected type are displayed in the Functions list box.

When the Paste Parameters option is checked, Analyzer makes it easy for you to specify most function parameters using the mouse. The Paste parameters option is checked by default.

If you choose a function from the Functions list box, Analyzer pastes the function and its required parameters into the Expression text box. To specify a field name, double-click the parameter to select it, then double-click a field name from the Available Fields list View. Analyzer inserts the field name as the function parameter.

You can also specify all function parameters by typing them using the keyboard.

Function parameters surrounded by angle brackets (<>) are optional. Either supply a value for the parameter and delete the angle brackets or delete everything within the angle brackets including the angle brackets.

Expression Syntax

There are four types of expressions: numeric, character, logical or date.

For example, AMOUNT+1 is a numeric expression, whereas AMOUNT>1 is a logical expression.

Depending on the point at which you start the Expression Builder, there may be only certain types of expressions that are valid. For example, if building a filter, only logical expressions are valid.

Character

To specify character fields, you can double-click the name of the field in the Available Fields list View or enter the field name using the keyboard. Specify character constants using the keyboard.

Field names must be spelled as they are in the Available Fields list View. Character constants must be enclosed in matching single or double quotes.

For example, PRODCLS="05".

Numeric

Numeric values are restricted to a minus sign where applicable, a decimal point and the digits that make up the number.

For example, -234.56.

Logical

True or false logical constants are entered either in uppercase or lowercase. No special punctuation is required.

Date and Time

You can easily specify date constants by clicking [Date] on the expression builder keypad. This displays the date selector, an interactive calendar that makes it easy to specify dates with the correct syntax.

You can also enter dates or times manually using the keyboard.

Date constants must be entered in YYYYMMDD format, enclosed in reverse quotes.

Note: The reverse quote character is located on the same key as the tilde ~ character on most keyboards.

For example, December 31st, 2001 would be entered as:

‘20011231‘

Time constants are entered in HH:MM:SS using 24 hour clock mode (the colons are mandatory) and must be enclosed in reverse quotes. For example, 11:35 a.m. is entered as:

‘11:35:00‘

whereas 11:35 p.m. is entered as:

‘23:35:00‘