# WEBfactory 2010

#### Remotely acknowledging alarms in WEBfactory 2010

Abstract

Check out this article and learn how to acknowledge WEBfactory 2010 alarms via remote alarm acknowledgement function.

The remote acknowledgment of an alarm can be performed using any software program that is able to insert SQL queries into a specific table of the WEBfactory SQL database. The remote acknowledgment of an alarm can be done if both of the following conditions are met:

• The Remote Alarm Acknowledgment property from WEBfactoryStudio is on;

• The remote acknowledgment of the alarm is done within a 90 seconds frame starting in the moment when the alarms has occurred.

If the above conditions are met, the user is able to acknowledge an alarm remotely by inserting an SQL script into the database. The SQL scrip will fill the RemoteAlarmAckRequests table form the database with the required information and the alarm will be automatically acknowledged.

Information required in the remote acknowledgment SQL scrips:

• AlarmID - the unique identification number of the alarm;

• UserID - the unique identification number of the user who has the permission to acknowledge the alarm.

• Parameter Status - the status of the alarm. The required value is 0, representing only active alarms.

• Timestamp - the time of the acknowledgment inserted as UTC time.

##### Activating the Remote Alarm Acknowledgment in WEBfactoryStudio
1. Open WEBfactoryStudio and click on the Settings tab.

2. In the Settings section of WEBfactoryStudio, go to Server Settings > Messaging > General.

3. Check the Remote Alarm Acknowledgment check-box. The setting is now enabled.

##### Building the SQL script to be inserted in the database.

The scrip will insert the required data in the RemoteAlarmAckRequests table.

1. Create a new document using the preferred text editor.

2. Declare the AlarmUID identifier. Knowing the name (NameTag) of the alarm that needs to be acknowledged (Alarm 1 in our example), we will use a SELECT statement to obtain the AlarmID from the Alarms table:

DECLARE @AlarmUID UNIQUEIDENTIFIER
SET @AlarmUID=(SELECT AlarmID FROM Alarms WHERE AlarmTag = 'Alarm 1')
3. Declare the UserUID identifier. Knowing the name of the user which has the permission to acknowledge the alarm (User 1 in our example), we will use a SELECT statement to obtain the ID from the Users table:

DECLARE @UserUID UNIQUEIDENTIFIER
SET @UserUID=(SELECT ID FROM Users WHERE Name = 'User 1')
4. Next, we need to insert the obtained data, along with the Parameter Status (0) and Timestamp (obtained using the GetUTCDate() method) in the RemoteAlarmAckRequests table of the database (in our example, the DemoProject database):

INSERT INTO [messengertest].[dbo].[RemoteAlarmAckRequests](ID,DateAck,AlarmID,UserID,Status,Result)
VALUES (Newid(),GetUTCDate(),@nAlarmUID,@nUserUID,0,0)
5. Save the document using the .SQL extension.

The WEBfactory Server will do a cyclic read of the RemoteAlarmAckRequest table. When it will find an entry inside the RemoteAlarmAckRequest table, the WEBfactory Server will check whether the alarm can be acknowledged based on the requirements mentioned at the top of that article.