Crystal Reports in the Real WorldWeb Report Alert Viewing


This Real World section covers two very practical options. First, good uses of Alerting are discussed and second, learn how put together a complex Record Selection Formula.

There are many creative ways to employ alerting in Crystal Reports to direct the report consumer to information that requires attention. The following scenario helps you understand the use of alerting.

As part of her daily function, a Sales Executive views the World Sales Report multiple times. Although she is familiar with the report, it is easy to overlook an important piece of information if it is hidden in the pages to follow. Simply by looking at the first page of the report, it might not be clear if there is a problem that requires attention. The Sales report that is discussed here is grouped by Country, Region, City, and Customer. The detail section shows the order date and order amount. For the purpose of the example, the problem in the business occurs when a sales order is booked for more than $5,000. An alert will be created that flags this circumstance (see Figure 11.6).

Figure 11.11. Create an alert and set the properties.


This sample report uses two techniques to draw the viewer's attention to the significant records. The first step highlights the Group Header in red if any record in the group sets the alert. To do this the report will evaluate a built-in function IsAlertTriggered ('Order Amount Alert') and set the highlighting appropriately (see Figure 11.12).

Figure 11.12. Set properties for the group header.


Additionally, to help draw the executive to the order(s) triggering the alert you will highlight the background of the detail record(s) that have triggered the alert. To do this, conditionally set the fill color of the detail section to yellow (see Figure 11.13).

Figure 11.13. Set properties for the detail line.


Now, when the executive views the sales report and drills to the detail data, the records highlighted in yellow indicate where the problem occurred.

Conditional formatting techniques described here can be applied to other attributes of report elements such as ToolTips. ToolTips can contain alert messages based on the triggered alerts. You can also conditionally hide or display report sections to highlight (see Figure 11.14).

Figure 11.14. Report highlighting draws attention to critical records.


Now consider a complex Record Selection Formula. The goal of a Selection Formula is to determine which records belong in a report. To do this, each record is evaluated against the given Selection Formula and only those records that return True are passed into the report. A number of very simple Record Selection Formula's are listed above. These formulas, so far, have all compared one field to one value, but what happens if there is a need to evaluate several different criteria for the same record? Frequently when this occurs, report authors try to resolve this with a complex nested if-then-else statement. There is a very simple alternative, however.

Consider this situation. What if the World Sales Report (from the samples that ship with Crystal Reports) needed to be filtered on the following three items:

  • Only orders from Canada/Mexico/USA

  • Only orders greater than $5,000

  • Only orders shipped within the last full month

The Selection Formula in Figure 11.15 explicitly shows how the different parts of the formula are evaluated and then combined to resolve to a single Boolean value. There are a number of ways to achieve this goal, and this formula could be written very differentlythis example is just intended to show the method step by step.

Figure 11.15. A sample Record Selection Formula that explicitly evaluates each criteria and returns one final evaluation.





Crystal Reports XI(c) Official Guide
Crystal Reports XI Official Guide
ISBN: 0672329174
EAN: 2147483647
Year: N/A
Pages: 365

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net