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

AlarmSumDelete

Deletes an alarm summary entry. You identify the alarm summary entry by the Index, returned by one of the alarm summary search functions.

By embedding this function in a loop, you can delete a series of alarm summary entries. To start deleting from the oldest entry, call the AlarmSumFirst() function to get the index, and then call AlarmSumNext() in a loop. To delete back from the most recent entry, call AlarmSumLast() and then AlarmSumPrev() in a loop.

You can also get the Index from the AlarmSumFind() function, which finds an alarm summary entry by its alarm record identifier and time of activation.

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.

Note: 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 synchronised 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

AlarmSumDelete(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 the specified alarm entry exists, otherwise an error is returned.

Related Functions

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

Example

/* This function deletes all alarm summary entries that match the 
			specified tag. */
FUNCTION
SumDelTag(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
AlarmSumDelete(Index);
END
Index=Next;
END
END

See Also

Alarm Functions

Published June 2018