AddEvent

There are two AddEvent functions. Both are documented in this topic to avoid confusion and to simplify searches.
* Use OperatorLog.AddEvent for creating custom records of operator activity related to tag values.
* Use AlarmManager.AddEvent for all other event recording.

OperatorLog.AddEvent

Description: This module is used specifically for logging messages when a user has written a control value.
Returns: Nothing
Usage: Script Only.
Function Groups: Alarm
Related to: nothing
Format: \OperatorLog.AddEvent(TagName, NewValue[, User, Priority, Area, OperatorNameFlag, Reserved, EvtOldValue, Units);
Parameters:  
TagName

Required text. The name of the tag being affected.

NewValue
Required. The new value of the tag.
User
Optional text. The full username of the operator
Priority
Obsolete parameter. Use INVALID as a place holder.
Area
Optional text. The area property of the tag.
OperatorNameFlag
Optional Boolean. If TRUE and no user is specified, the current operator name is logged. Defaults to TRUE.
Reserved
Obsolete parameter. Use 1 as a placeholder.
EvtOldValue
Optional. The previous value of the tag.
Units
Optional text. Units of the new value.

Example:

  { Commit WriteValue when DoChange is TRUE }
  If DoChange;
  [
    DoChange = FALSE;
    \OperatorLog.AddEvent(\Name, WriteValue, Invalid, Invalid, Invalid, 1, 1, \Value, 1));
    \Set(WriteValue);
  ]

OperatorLogTemplate

 

AlarmManager.AddEvent

Description: Adds an event to the System Event database (or another Alarm Database if specified). The alarm does not need to be commissioned.
Returns: Nothing
Usage: Script Only.
Function Groups: Alarm
Related to: nothing
Format: \AlarmManager.AddEvent(Name, Area[, Description, UserID, Timestamp, Value, Units, MachineID, Device, Custom, AlarmDBName, MessageID, NoteRequired]);
Parameters:  
Name

Required text. A unique name for the source of this event.

Area
Required text. The area for this event. If INVALID the "System" area will be used.
Description
Optional text or PhraseID. The description for the source of this event.
UserID
Optional. Either the User ID to be logged with this event, or a Boolean.
If a Boolean is used, then if TRUE, the calling session's User ID will be logged.
If FALSE or INVALID (the default), no user ID will be logged.
Timestamp
Optional. The timestamp of the event in UTC. If not valid the current time will be used.
Value
Optional. A value to log.
Units

Optional. The value's units.

MachineID
Optional. The workstation's machine ID. If INVALID, the current workstation's ID will be obtained and used.
Device
Optional. Name of the client device.
Custom
Optional. An array or a structure of custom values to be recorded.
AlarmDBName
Optional. The AlarmDatabase tag to use. Defaults to SystemEventDB.
MessageID
Reserved. Use INVALID as a place holder.

NoteRequired

Optional Boolean. Set TRUE to prompt for a note before logging the event.

Example

  If ActionHappened;
  [
    { Log this event }
    \AlarmManager.AddEvent(Invalid, Invalid, { default name and area }
                           "CustomActionLabel", TRUE);
    ActionHappened = FALSE;
  ]