Description:
How can I configure the alarm to be acknowledged only after the user justifies the alarm’s acknowledgment? And how can I save this information alongside the alarm in the database?
Solution:
To do so, you can use the Viewer‘s ESign function, where the user can log in and write a comment. For example:
‘Returns the selected alarm object
set alarm = Screen.Item(“E3Alarm1”).GetFocusedEvent()
If TypeName(alarm)=”IEventStatus” then
‘Electronic Signature
If Application.ESign(alarm.AlarmSourceName, alarm.Message, “Acknowledgment”, , , User, Comment) then
‘Does not acknowledge if the comment is blank
If Comment = “” then
MsgBox “Please enter the reason of the acknowledgment”, vbExclamation
Exit Sub
End if
‘Saves the comment and acknowledges the alarm
Application.GetObject(“Data.AlarmAckReason”).Value = Comment
Application.GetObject(alarm.FullAlarmSourceName).Ack(User)
‘Sets the comment to blank
Application.GetObject(“Data.AlarmAckReason “).Value = “”
End if
End if