Cicode Programming Reference > Cicode Function Categories > Alarm Functions Introduction > AlarmGetFieldRec

AlarmGetFieldRec

Gets the contents of the specified field in the specified alarm record. If calling this function from a remote client, use the MsgRPC() function.

Note: Record numbers obtained from AlarmGetDsp are not valid for this function. Instead use AlarmFirstTagRec() to get the record. This should be called from the server side using MsgRPC.

When the Alarm Server is not in the calling process, this function will become blocking and cannot be called from a foreground task. In this case, the return value will be undefined and a Cicode hardware alarm will be raised.

Syntax

AlarmGetFieldRec(Record, sField [, nVer] [, ClusterName] )

Record:

The alarm record number, returned from any of the following alarm functions:

To store this value, use data type Int in Cicode or Long for variable tags (Long needs 4 bytes).

sField:

The name of the field from which the data is retrieved.

Field Description
Category Alarm category
Desc Alarm description
Help Alarm help page
Name Alarm name
Tag Alarm tag
Time The time that the alarm changed state (hh:mm:ss)
Comment Operator comments attached to the Alarm Log entry (if any)
Date The date that the alarm changed state (mm/dd/yyyy)
DateExt The date that the alarm changed state in extended format
Type The type of alarm or condition
State The current state of the alarm
Value The current value of the alarm variable
High High Alarm trigger value (Only Valid on Analog Alarms)
HighHigh High High Alarm trigger value (Only Valid on Analog Alarms)
Low Low Alarm trigger value (Only Valid on Analog Alarms)
LowLow Low Low Alarm trigger value (Only Valid on Analog Alarms)
Rate Rate of change trigger value (Only Valid on Analog Alarms)
Deviation Deviation Alarm trigger value (Only Valid on Analog Alarms)
Deadband Deadband (Only Valid on Analog Alarms)
LogState The last state that the alarm passed through
AlmComment The text entered into the Comment field of the alarm properties dialog.
Custom1..8 Custom Filter Fields
State_desc The configured description (for example, healthy or stopped) of a particular state
UserName The name of the user (User Name) who was logged on and performed some action on the alarm (for example, acknowledging the alarm or disabling the alarm, etc.). Be aware that when the alarm is first activated, the user name is set to "system" (because the operator did not trip the alarm).
FullName The full name of the user (Full Name) who was logged on and performed some action on the alarm (for example, acknowledging the alarm or disabling the alarm, etc.). Be aware that when the alarm is first activated, the full name is set to "system" (because the operator did not trip the alarm).
UserDesc The text related to the user event
OnDate The date when alarm was activated
OnDateExt The date (in extended format) when the alarm was activated (dd/mm/yyyy)
OffDate The date when the alarm returned to its normal state
OffDateExt The date (in extended format) when the alarm returned to its normal state (dd/mm/yyyy)
OnTime The time when the alarm was activated
OffTime The time when the alarm returned to its normal state
DeltaTime The time difference between OnDate/OnTime and OffDate/OffTime, in seconds
OnMilli Adds milliseconds to the time the alarm was activated.
OffMilli Adds milliseconds to the time the alarm returned to its normal state.
AckTime The time when the alarm was acknowledged
AckDate The date when the alarm was acknowledged
AckDateExt The date (in extended format) when the alarm was acknowledged (dd/mm/yyyy)
SumState Describes the state of the alarm when it occurred
SumDesc A description of the alarm summary
Native_SumDesc A description of the alarm summary, in the native language
Native_Comment Native language comments the operator adds to an Alarm Summary entry during runtime.

nVer:

The version of an alarm.

If an alarm has been triggered more than once in a given period, the version lets you distinguish between different instances of the alarm's activity.

The version is used in filtering alarms for display. A query function passes a value to this parameter in order to get field information for a particular alarm.

This parameter is not needed when you use AlarmGetFieldRec() for purposes other than filtering. It will default to 0 if omitted.

ClusterName:

Specifies the name of the cluster in which the Alarm Server resides. This is optional if you have one cluster or are resolving the alarm server via the current cluster context. The argument is enclosed in quotation marks "".

Return Value

The alarm field data (as a string).

Related Functions

AlarmFirstTagRec, AlarmNextTagRec, MsgRPC

Example

FUNCTION
GetNameFromTag(STRING sTag)
INT record;
STRING sName
record = AlarmFirstTagRec(sTag, "", "");
IF record <> -1 THEN
sName = AlarmGetFieldRec(record,"NAME");
ELSE
sName = "";
END
RETURN sName;
END

See Also

Alarm Functions