Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

5 Reporting Design Tips

Every report designer always has some tricks up their sleeves to make their lives easier. These tricks might be acquired over time and sometimes you just come across a new (and better) way of doing something by chance. Here are five tips I’ve collected over the years that come in handy for me, and hopefully for you as well!

1. Formatting String Formulas: Do you have a string formula that needs to use different formatting for different words? For example, you want to bold a certain word that needs emphasis. Crystal won’t let you do this normally because it requires the entire formula to use the same formatting for all the words. But you can trick it using HTML formatting. For example, the following formula uses HTML to emphasize a store’s current sale:

“Hello ” & {Customer.Name} & “, if you call back in three days we’ll give you a <b>10% discount!</b>”

By putting the HTML bold tags around the 10% discount, it turns that phrase into bold, and the rest of the text in the formula just stays the regular font. However, you must tell Crystal Reports that the formula outputs HTML tags so that it knows how to format it. To do this, right-click on the formula field and select Format Field. Go to the Paragraph tab and set the Text Interpretation property to HTML.

2. When comparing two text fields to each other, you can sometimes have “identical” strings not match. This is because there can be hidden spaces before or after the string. The spaces will result in Crystal saying that the fields aren’t equal, and you won’t be able to notice since spaces can’t be seen. The trick I use is to put a dummy character before and after each field so I can see if there are any hidden spaces between the dummy characters and the word. The formula can be something as simple as:

“x” & {Customer.CustomerName} & “x”

3. Someone asked a question on the Facebook wall a while back about not being able to delete a formula b/c Crystal says it is being used someplace on the report. It’s worth repeating some of the most common “hiding places” for formulas on your report:

  • The outside of the report margins. To find them, re-size the report to make it much larger (or change page orientation to landscape). Look along the edges where there is white space.
  • Used as a linking field with sub-reports.
  • Used in a group name.
  • Used in the Highlighting Expert dialog box.
  • Right-click on the formula and choose “Find In Formulas” to see if other formulas are referencing it.

4. Wondering which programming language to write your formulas in? Crystal gives you the option to use Crystal syntax or Basic syntax. Crystal syntax is the original formula language used by the first versions of Crystal Reports. Unfortunately, some find it confusing b/c it is very similar to the C programming language. Report designers wanted an easier language to program in, so Basic syntax was added to Crystal Reports. Is is very similar to the BASIC language that many people learned in school (even non-programmers learned it). Basic syntax is typically the easiest to get up to speed on.

That said, I find that since Crystal syntax is the original formula language, and also the language listed by default, most code examples you find on the web and in forums are in Crystal syntax. So even though Basic syntax is easier to use, the majority of people stick with Crystal syntax till they learn it.

5. Many people don’t realize that the data in the Group Tree can have custom formatting. If you right-click anywhere on the group tree, nothing about customization appears. It seems as though it’s “what you see is what you get”. But that’s not the case.

The Group Tree uses the formatting specified in the Fields tab of the Options dialog box. This Fields tab has a button that sets the default formatting properties for each data type (string, date, number, etc.).

Now the trick to changing the formatting in the group tree is that you can’t just go into the Options dialog box and click on the Fields tab to set the formatting. The group tree will ignore the changes. This is because the formatting in the group tree is applied at the time the group IS CREATED. If you change the formatting after the group has been created, it is ignored. You have to delete the group, change the formatting, and create the group again. It’s a hassle, and you could even lose some fields in the group header/footer sections, so be careful before you do this and even move report objects out of the group sections temporarily until you finished the formatting.

I hope these tips gave you some new insight into how to make your own reports easier to write! If you have some tips of your own to share, please post them in the comments below so that we can all learn from your experience!