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


The user-defined query function set in AlarmSetQuery. Called for each active alarm, the query function can be written to display an alarm based on specific information (for example, OnDate). To examine the information in an alarm field, call the function AlarmGetFieldRec from within your query function.

Note: The function name "QueryFunction" can be any valid Cicode function name specified by the user.


QueryFunction(nRID, nVer [, Arg01, Arg02, ....] )


The record number of the alarm currently being filtered. This provides the query function with access to information about the alarm. This parameter is represented with an INT, and needs to be the first parameter of your query function.


The version of an alarm.

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

Since you may wish to display on a page alarms which have more than one instance, this parameter needs to be passed to AlarmGetFieldRec in order to correctly filter the alarms.

The version is represented with an INT, and needs to be the second parameter of your query function.

Arg01, Arg02:

A list of arguments, separated by commas.

The query function is passed the arguments specified in the call to AlarmSetQuery(). For this reason, the arguments listed in AlarmSetQuery() needs to be of the same type as those defined in the query function.

Return Value

The return value needs to be defined as an INT with a value of either 1 (TRUE) or 0 (FALSE). If the function returns a value of TRUE, the alarm being filtered is displayed, otherwise it is excluded from the alarms list.

Related Functions

AlarmSetQuery, AlarmGetFieldRec, AlarmSetInfo


! The query function AlarmQueryDate() compares sDate with the 
OnDate of each alarm.AlarmGetFieldRec() is used to check the 
contents of the "OnDate" field for each alarm.
! If they are the same, the alarm is displayed.
AlarmQueryDate(INT nRID, INT nVer, STRING sDate)
INT bResult;
IF sDATE = AlarmGetFieldRec(nRID, "OnDate", nVer) THEN
bResult = TRUE;
bResult = FALSE;
RETURN bResult;

See Also

Alarm Functions