Point Listing that Uses Color to Indicate Alarm Status

You can configure the entries in a report so that their color is determined by their status at the time of report generation.

This example shows how alarm descriptions in a report can be configured to use color to indicate the alarm status of each point at the time that the report was generated.

The color change is configured using a formula. When using formulas in Crystal Reports, you need to use Basic or Crystal syntax, as applicable (see the documentation supplied with the Crystal Reports application for details).

Example:

A report uses dynamic colors to indicate the alarm status of each point, at the time that the report was generated.

The report uses the CDBPoint table.

The report layout is configured to display records for the following fields:

  • Name—The name of the item.
  • CurrentValueFormatted—The value of the item.
  • AlarmDesc—The description of the current alarm state.

    The field titles have been slightly reworded within the report.

    To set each record so that the ‘Alarm Description’ value changes color, depending on the alarm state of the item, the AlarmDesc field in the ‘Detail’ section of the report is formatted, so that its font color alters in line with the item’s alarm state.

    To do this, a Formula is specified for the font color. The Formula button is selected next to the font color in the Format Editor window, in order to display the Formula Editor window in which the required formula is entered.

    In this particular report, it was decided that the ‘Alarm Description’ entries should use the following colors to represent the alarm state of each point:

  • Black—Normal state (point not in alarm)
  • Gray—Alarms are disabled
  • Green—The alarm has cleared but remains unacknowledged
  • Red—The point is in alarm

    The AlarmState field in the CAlarmObject table indicates an item’s alarm state. The Database Schema was used to determine the AlarmState values that indicate each alarm state. These are:

  • 0—Normal
  • 1—Disabled
  • 2—Acknowledged Uncleared
  • 3—Unacknowledged Cleared
  • 4—Unacknowledged Uncleared.

    Therefore following formula was used for the font color for the ‘Alarm Description’ entries:

    IF {CAlarmObject.AlarmState}= 0 THEN crBlack ELSE IF {CAlarmObject.AlarmState}= 1 THEN crGray ELSE IF {CAlarmObject.AlarmState}= 3 THEN crGreen ELSE crRed

    (The Formula Editor window allows selection of field names and color constants—see the documentation supplied with the Crystal Reports application for details.)

    When the report is generated, the formula determines the ‘Alarm Description’ font color that is used for each entry in the report.


Disclaimer

Geo SCADA Expert 2022