Home | SkillForge Blog | Code Hinting in Crystal Reports Formula Workshop

Code Hinting in Crystal Reports Formula Workshop

Business Intelligence, Business Objects, Crystal Reports

When using Crystal Reports, formulas play a large role in preforming such basic tasks as conditional formatting, selecting records, and general calculations. The code window for all of these tasks is called the Formula Workshop. It is a centralized window divided into five sections; Workshop tree, Field Tree, Function Tree, Operator Tree, and Definition area.


Normally when you want to create a basic calculation formula such as taking one database field and multiplying it by another database field you will expand your connection object within the Field Tree so you can see all of your available tables. Clicking the plus sign next to each table will reveal all of the fields in that table. You next step is either double-click the field to insert it into the Definition area or left-click and drag it into the Definition area.

The same can be said for inserting functions or operators. The only difference being you would need to expand the categories each function or operator is listed under.

The Definition area offers an interesting code hinting feature I find very useful. If I want to use a particular field from a database table all I need to do is type an opening curly brace in the Definition area and a pop-up tip gives me a list of all my available database tables. Typing the first letter of the table will select it and I can now press the tab key to insert it. As soon as it is inserted another pop-up tip shows a dot and all the fields within that table. Typing its first letter or first few letters will select it and I can now press tab to insert it.



A wonderfully fast way to get to any function or operator in the Definition area is to use a simple keyboard shortcut. Just press Ctrl + Spacebar and the same pop-up tip will start an alphabetical list of functions and operators. As you type the pop-up tip eliminates anything that does not contain the letters you are typing.



As soon as you can see the function or operator you are looking for you can use your up and down arrow keys to select the item you want. Pressing the tab or enter key will insert it.


This can be a real time saver because you do not need to expand the function or operator categories. Just start typing and your code can be inserted.