Alarm Notification Template Hooks

You can create a hook module to override the behavior of most tokens used by Alarm Notification Templates
The alarm template tokens that can be overridden are shown in the following list.

Token

Default Meaning

A

Area of the Alarm tag.

C

Custom data provided by the application

D

Date of the alarm

F Full tag name
H Short tag name
K Station number
(Part of every Polling driver, and Station type. Context tags used as site must be given a property named "Stn", in which the station number may be stored.)

M

Alarm description

O Operator

P

Priority of the alarm.

S Status of the alarm

T

Time of the alarm

U

Units of the Triggering tag.

V

Alarm value (this is the value of the alarm trigger at the time that it triggered the alarm)

Z Setpoint.

Create an Alarm Template Hook

Alarm template hooks are modules that you add, either to your application as new files or as submodules of custom tag types that you have written.

If creating an alarm template hook for use with any alarm, it should be declared simply as a module in your application's AppRoot and not as a member of any of the classes found in that file. The declared name of the module must take the form:

AlarmTemplateHook?

where ? is one of the tokens in the preceding table. For example, a template hook for a custom alarm description (M) will be declared as:

AlarmTemplateHookM Module "MyCustomMessageHook.SRC";

The code for such a module might take the following form. In this simplified example the alarm description is transformed to upper case letters.

(
  AlarmRecord;
  Language;
)
[
  If 1;
  [
    Return(ToUpper(GetPhraseForLang(PickValid(AlarmRecord.DescPhraseID, AlarmRecord.Description), Language)));
  ]
]

Parameters

The parameters for all AlarmTemplateHook? modules are:

AlarmRecord

An instance of the AlarmRecord structure

Language

A language identifier string that can be passed into GetPhraseForLang().

Return Value

The return value for all AlarmTemplateHook? modules must be a text or numeric value that will be written out in place of the %? token in the template.