Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

8.07 Tutorial 8-2 Adding Optional Sections

Tutorial 8-2. Adding optional sections.

If you can use sections to suppress blank lines, it makes sense that you can use sections to do the opposite: add optional information. For example, a report can print a section just for unique circumstances. An employee report could print a special note if an employee’s birthday falls within the current month. Invoices can print reminders to late customers that they need to pay or else penalties will be incurred. A recipe listing can print additional notes for favorite recipes. Each of these examples benefits from using multiple sections because if the section doesn’t have any data to print, additional room isn’t allocated on the report.

You might be wondering what the benefit of an optional section is. If you want to add report objects below other report objects, why don’t you just do it in the same section and hide them when they aren’t used? The reason why you want to use an additional section is so there isn’t any wasted space when the information isn’t needed. If you were to hide the individual objects in the same section, they will still take up space on the report and leave an obvious gap. By adding an additional section and only showing it when necessary, the report keeps a consistent look.

  1. To add an optional section, right-click on the section it should go below and select Insert Section Below.
  2. Add the optional report objects to the new section and format them appropriately.
  3. Right-click on the section and select Section Expert. This opens the Section Expert dialog box.
  4. Click on the Formula Workshop button and enter a formula for the Suppress option. It should return False for the condition that should show the section and return True for the condition that should suppress it. An example in Basic syntax is below.
if {Orders.Order Amount} > (Customer.Credit Limit} then false else true;

This formula is from an invoice that warns the customer when they are over their credit limit. If the Order Amount is greater than the Credit Limit, then it returns False. Thus, the section is not suppressed and the customer sees the warning. Otherwise it returns True to suppress the section.