TagsDBSetAlarm
- Last UpdatedOct 29, 2026
- 3 minute read
TagsDBSetAlarm is a built-in function that sets the value of a property of an alarm condition during run time.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
TagsDBSetAlarm |
Tags Database |
Synchronous |
No |
Supported (see Notes below) |
Not supported |
Not supported |
Not supported |
Not supported |
Syntax
TagsDBSetAlarm(strTagName,numAlarmType,numProperty,strOrNumVal)
TagsDBSetAlarm ( strTagName , { numAlarmType | -1 | 1 | 2 | 4 | 8 | 16 | 32 | 64 } , { numProperty | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 } ,strOrNumVal)
strTagName
The name of the project tag on which the alarm property will be set.
Tip: To set other properties on project tags, use the function TagsDBSetTagProperty.
numAlarmType
The type of alarm on the specified project tag, identified by one of the following values:
|
Value |
Alarm Type |
|---|---|
|
-1 |
General properties that apply to all alarm types on the specified project tag |
|
1 |
HiHi |
|
2 |
Hi |
|
4 |
Lo |
|
8 |
LoLo |
|
16 |
Rate |
|
32 |
DeviationP |
|
64 |
DeviationM |
numProperty
The alarm property that you want to set.
When setting a property of a specific alarm type (that is, if numAlarmType is greater than 0), the property is identified by one of the following values:
|
Value |
Property |
Data Type |
|---|---|---|
|
0 |
Limit value |
Real |
|
1 |
Message |
String |
|
2 |
Alarm group (or worksheet) number |
Integer |
|
3 |
Priority |
Integer |
|
4 |
Selection |
String |
|
5 |
Custom field 1 |
String |
|
6 |
Custom field 2 |
String |
|
7 |
Custom field 3 |
String |
|
8 |
Custom field 4 |
String |
|
9 |
Custom field 5 |
String |
|
10 |
Custom field 6 |
String |
|
11 |
Custom field 7 |
String |
|
12 |
Custom field 8 |
String |
|
13 |
Custom field 9 |
String |
|
14 |
Custom field 10 |
String |
When setting a property that applies to all alarm types on the specified project tag (that is, if numAlarmType is -1), the property is identified by one of the following values:
|
Value |
Property |
Data Type |
|---|---|---|
|
0 |
Alarms Enabled |
Boolean |
|
1 |
Remote Ack tag |
String (tag name) |
|
2 |
Translation Enabled |
Boolean |
|
3 |
Dead Band Value |
Real |
|
4 |
Off |
String |
|
5 |
On |
String |
|
6 |
Ack |
String |
|
7 |
Deviation Setpoint |
String (tag name) |
|
8 |
Deviation Dead Band |
Real |
For more information about all of these alarm properties, see Tag Properties.
strOrNumVal
The value to set to the specified property. The value must be of the appropriate data type.
Returned value
This function returns one of the following possible values:
|
Value |
Description |
|---|---|
|
-4 |
The specified project tag (strTagName) does not exist. |
|
-3 |
Wrong parameter type or inconsistent value. |
|
-2 |
Invalid number of parameters. |
|
-1 |
The function TagsDBBeginEdit was not executed successfully before this function was called. |
|
0 |
Function executed successfully. |
Notes
The following restrictions apply to the execution of this function:
-
The function can be executed only on the project runtime server — it cannot be called by a Graphics Script, Screen Script, or Command animation running on a thin client;
-
The TagsDBBeginEdit function must have been executed previously, in order to lock the tags database for editing; and
-
The TagsDBEndEdit function must be executed when the editing is done, in order to release the tags database and resume normal runtime operations.
For more information about the Tags Database functions and examples of how to use them, see Using TagsDB functions to edit the tags database during run time.
Note: A specific alarm condition, as defined by the tag name and the alarm type (for example, the HiHi alarm on MyTag1), can be in only one alarm group at a time. Therefore, please remember that when you assign an alarm condition to an alarm group, it will be removed automatically from its previous group, if any.
Also, make sure that an alarm group with the correct group/worksheet number actually exists before you try to assign an alarm condition to it.