Adding Alerting to Your Reports
Although calling out outlying values can be accomplished by using conditional formatting, the alerting feature inside Crystal Reports allows for more interactive identification of key data as well as pushing of those alerts to end users via Crystal Enterprise's alerting functionality.
A report alert is a custom notification created within Crystal Reports, triggered when a predetermined condition is met. An alert is comprised of three integral parts:
- Name
- Trigger (condition or threshold)
- Message
Alerts serve the dual functions of bringing end-user attention to a certain condition being met and focusing end-user attention on specifically relevant data in a reportthereby increasing user efficiency. Some examples of reports in which alerts could provide a benefit are outlined in Table 11.1.
Report |
Alert |
Alert Trigger and Result |
---|---|---|
Product Sales Report |
Product Profitability Warning |
Trigger: Specific product profitability below 10% Result: A listing of the least successfully selling products |
Customer Churn Report |
Regional Customer Churn Warnings |
Trigger: Specific regions where Customer Churn Rate is higher than 3% in a quarter Result: A listing of regions to increase competitive analysis or to review regional management practice |
Income Statement |
Company Divisions with Net Losses |
Trigger: Company division with net income < 0 Result: A listing of divisions where deeper business analysis is required |
Report alerts are triggered when the report is processed and the associated condition has been met. When this condition is true, the alert message will be displayed. Figure 11.3 displays a triggered alert from within the Crystal Reports Designer.
Figure 11.3. A report alert being triggered.
Creating, Editing, and Using Alerts
To create or edit alerts in Crystal Reports, select the Report, Alerts, Create or Modify Alerts menu items. This dialog (shown in Figure 11.4) enables you to create a new alert, edit existing alerts, and remove existing alerts.
Figure 11.4. Clicking Edit on the Create Alerts dialog opens the Edit Alert dialog.
To create the alert, follow these steps:
- Give the alert a name. This name should be meaningful and will be displayed to the user when the alert is triggered.
- Specify a condition for which to trigger the alert. An example of this would be {Customer.Last Year's Sales} < $10000. The condition is simply a formula using either Crystal or Basic syntax that evaluates to a true or false result. True means the alert should be triggered; false means that it should not.
NOTE
You can use other formulas and parameters inside this condition. Using a parameter to determine the threshold on your alert is useful because the report could then be viewed by different audiences with different thresholds, and they could still see the alert triggered for their respective numbers.
- Give the alert a message to display when it has been triggered. This can be a hard-coded string, or can be a formula such as
"Sales are over $" + ToText({Customer.Last Year's Sales})
To see your alert in action, refresh the report with data that meets your alert condition, and triggered alerts will be displayed.
Finally, not only are you notified that the alerts have been triggered, you can click the View Records button on the Report Alerts pop-up dialog to filter the report to show only those records that triggered the alert. This is a good way to draw attention to the key outliers in the data.
Using Alerts in Crystal Enterprise
The Report Alerts dialog displayed in Figure 11.3 is only available from within the Crystal Reports Designer. If you are delivering your reports via another mechanism such as the Web, alerts are handled differently. To have your end users take advantage of Crystal Reports alerting, you will need to either use Crystal Enterprise for report distribution or exploit the built-in alert functions (IsAlertEnabled(), IsAlertTriggered(), and AlertMessage()) within formulas you create in your report.
For more information on Crystal Enterprise, see Chapter 24, "Crystal Enterprise Architecture."
Typically, alerts can be shown to end users in a portal, which then links back to the report.
TIP
End users viewing a report from an alert in Crystal Enterprise do not see the items matching the alert conditionsthey see the entire report. This leads to some discontinuity both from the Crystal Reports experience and also from the end users' expectation that they should now see values called out in the alert.
To make this more logical for the end user, create a version of the same report (perhaps use a naming convention like ALERT_reportname.rpt) with the alert and also a filtering condition matching the alert condition. Thus, when end users click on an alert in Crystal Enterprise, they will see a version of the report containing only the relevant values.