Share via


Formula Editor Dialog Box

The Formula Editor is a major component of the Formula Workshop dialog box. The editor has a variety of names depending on the kind of formula you are working with:

  • Formula Editor.
  • Format Formula Editor.
  • Record Selection Formula Editor.
  • Group Selection Formula Editor.
  • Running Total Condition Formula Editor.

The Formula Editor is similar to the Custom Function Editor and the SQL Expression Editor. These editors are included in this description.

This dialog box appears when you edit an existing formula field or create a new formula field by right-clicking Formula Fields in the Field Explorer and selecting New. After you name your formula, the Formula Editor dialog box appears.

Formula Editor Windows

The Formula Editor contains four main windows.

Report Fields Report fields contain all database fields accessible for your report. They also contain any formulas or groups already created for the report.

Note

This window does not appear when you create a custom function.

Functions Functions are pre-built procedures that return values. They perform calculations such as average, sum, count, sin, trim, and uppercase.

Note

Changing the syntax from Crystal syntax to Basic syntax or vice versa will change the list of functions in the Functions window as well as the list of operators in the Operators window. The functions and operators differ from syntax to syntax.

Operators Operators are the "action verbs" you use in formulas. They describe an operation or an action to take place between two or more values.

Examples of operators: add, subtract, less than, and greater than.

Formula Text Window This is the area where you create or edit a formula.

Create a formula by double-clicking on any of the components listed in the Report Fields, Functions, or Operators trees. When you choose a component, the required syntax is also inserted. You can also manually enter a formula.

When you are finished creating or editing a formula, click the Check button to identify any errors in the formula. Click the Save button to save the formula.

Formula Workshop Buttons

The buttons for the General Toolbar of the Formula Workshop perform the following functions:

Button
Description
Closes the Formula Workshop after prompting you to save changes. If you save changes, your formula is checked for errors.
Saves the formula, SQL Expression, or custom function.
Creates a new formula of the type selected from the list. Also used to create a new custom function or SQL Expression.
Shows or hides the Workshop Tree.
Toggles display between Custom Function Editor and Custom Function Properties Dialog Box. Custom functions and formulas (where possible) are displayed in the selected mode until this button is clicked again.
Opens the Formula Expert. Use the Formula Expert to help you create a formula based on a custom function.

Note

This button is not available when creating a custom function.

Opens the online help for this dialog box.

The buttons for the Workshop Tree Toolbar of the Formula Workshop perform the following functions:

Button
Description
Lets you rename the selected formula, custom function, or SQL Expression.
Deletes the selected formula, custom function, or SQL Expression.
Expands or collapses the selected node in the Workshop Tree. Also works with multiple node selections.
Shows or hides report object nodes in the Formatting Formulas folder if the objects do not have formulas associated with them.

The buttons for the Expressions Editor Toolbar of the Formula Workshop perform the following functions:

Button
Description
Tests the syntax of the formula or custom function and identifies syntax errors if they are found.
Undoes the last action performed.
Redoes the last action.
When you select a field from the Report Fields window and click the Browse Data button, a dialog box appears with a list of the values for the selected field.

View values for the selected field and select individual values to insert into your formula.

Note

This button is not available for custom functions.

Searches the Formula Editor for a specified word, number, or formula string.
Inserts a bookmark at the beginning of a selected formula line. Click the button again to remove the bookmark.
Jumps to the next bookmark.
Jumps to the previous bookmark.
Deletes all bookmarks in the current formula.
Arranges all Report Fields, Functions, and Operators trees in alphabetical order.
Hides or views the Report Fields tree.

Note

This button is not available for custom functions.

Hides or views the Functions tree.
Hides or views the Operators tree.
Allows you to select Crystal Syntax or Basic Syntax as your formula syntax. For more information, see Formula Reference.

Changing the syntax from Crystal syntax to Basic syntax or vice versa will change the list of functions in the Functions window as well as the list of operators in the Operators window. The functions and operators differ from syntax to syntax.

Comments out the highlighted selection of a formula. Commented lines are not evaluated as part of the formula.

Shortcut Keys

The following shortcut keys work in the Formula Editor:

Keyboard Combination
Action Performed
Alt+B
Opens Browse dialog box for highlighted field.
Alt+C
Checks formula for errors.
Alt+F
Opens or closes the Shows Field tree.
Alt+M
Comments out or removes comments from current line
Alt+O
Sorts contents of trees.
Alt+P
Opens or closes the Shows Operator tree.
Alt+S
Saves formula without closing Formula Editor.
Alt+U
Opens or closes the Shows Function tree.
Ctrl+A
Selects all.
Ctrl+C
Copies.
Ctrl+End
Goes to the end of the last line of the formula.
Ctrl+F
Opens the Find dialog box (same as clicking the find button).
Ctrl+F2
Sets bookmark.
Ctrl+Shift+F2
Clears all bookmarks.
Ctrl+Home
Goes to the beginning of file.
Ctrl+Left Arrow
Goes to the beginning of the left word (+Shift key will do the selection).
Ctrl+N
Opens Formula Name dialog box, or another appropriate dialog box, to create a new formula.
Ctrl+S
Saves formula and closes Formula Workshop.
Ctrl+T
Sets focus to the syntax name list box.
Ctrl+Shift+Tab
Changes focus to next control box (reverse order of Ctrl-Tab).
Ctrl+Tab
Changes focus to next control box.
Ctrl+V
Pastes.
Ctrl+X
Cuts.
Ctrl+Z
Undoes an action.
Ctrl+Shift+Z
Repeats an action.
Ctrl+Space
Keyword Auto Complete — shows a list of the functions available.
End
Goes to end of line.
Enter
Copies a selected object from a list to the formula text box.
F2
Goes to next bookmark.
F3
Finds next item as defined in the Find dialog box.
Shift+F2
Goes to previous bookmark.

See Also