Cicode Programming Reference > Cicode Function Categories > Alarm Functions > AlarmSumCommit

AlarmSumCommit

Commits the alarm summary entry to the Summary Device specified in the alarm category of the entry. The same alarm summary entry is unable to be committed twice. The Cicode function returns an error code if the entry has been commited by timeout (referring to [Alarm]SummaryTimeout parameter), or if AlarmSumCommit() is called twice. An entry is not commited by timeout if AlarmSumCommit() is called on this entry.

If the Alarm Server is not in the calling process, the calling process needs to run from the same machine as the alarm server.

This function can only be used if the Alarm Server is on the current machine. 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.

In a redundant pair scenario, this function will return an error condition and not do anything if the current server is not main. You can call this function on the primary server and the standby server so that function can succeed on one of the two servers in the specified cluster. The change will be synchronized to the other server after a short period of time (typically in 5 seconds).

Note: This function will only work while the record is writable which is controlled by the ArchiveAfter Parameter. Refer to the topic Configure the Archiving Parameters in the main help for more information.

Syntax

AlarmSumCommit(Index [, ClusterName] )

Index:

The alarm summary index (returned from the AlarmSumFirst(), AlarmSumNext(), AlarmSumLast(), AlarmSumPrev(), AlarmSumAppend(), or AlarmSumFind() function).

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

0 (zero) if successful, otherwise an error is returned.

Related Functions

AlamSumDelete, AlarmSumSet, AlarmSumType, AlarmSumAppend, AlarmDelete, MsgRPC, AlarmSumGet, AlarmSumFirst, AlarmSumNext, AlarmSumLast, AlarmSumPrev, AlarmSumFind, AlarmSplit, AlarmSumSplit

Example

/* This function commits alarm summary entries that match the
				specified tag. */
FUNCTION
SumCommitTag(STRING sTag)
INT Next;
INT Index;
STRING Name;
Index=AlarmSumFirst();
WHILE Index<>-1 DO
Name=AlarmSumGet(Index,"Tag");
Next=AlarmSumNext(Index);
IF Name=sTag THEN
AlarmSumCommit(Index);
END
Index=Next;
END
END

See Also

Alarm Functions

Published June 2018