Implementing a query based on the custom alarm filters you have defined requires two steps:
INT FUNCTION Query
(INT nRecordID, INT nVersion, STRING sInfo)
The value to be used in calls to AlarmGetFieldRec;
for example AlarmGetFieldRec(nRID, "CUSTOM1", nVer).
(See the help for AlarmGetFieldRec for details on the fields available.)
The version of the record; this will increase each time a record is changed.
A user defined string to be used to control the logic in the Query function.
A 0 or 1 is expected as a return value, with 1 determining that the record will be displayed.
You want to create a query that calls current alarms for the conveyors in your plant. This could be drawn from the alarm tags you have identified as being associated with a conveyor, by applying the keyword "conveyor" to the field Custom Filter 1.
The query function you would create would be as follows:
FUNCTION CheckCustom1(INT nRid, INT nVer, STRING sValue)
// Get the information in CUSTOM1
sCustom = AlarmGetFieldRec(nRid, "CUSTOM1", nVer);
IF sCustom = sValue THEN
// Lets display this
// Skip over this
Say you then want to create a button on a graphics page that lists current conveyor alarms. You would implement this by applying the AlarmSetQuery function to the button.
AlarmSetQuery(0, "CheckCustom1", "conveyor");
You could also create a reset button that clears the current displayed list by cancelling the query:
AlarmSetQuery(-1, "", "")
You have the choice of calling a specific Cicode function, for example, "Customfeld1", with the argument "pumpcontrol", or using a more generic approach with the function "Checkfield" with argument "CUSTOM1= pumpcontrol". In this case, the Cicode function parses the passed string and checks the field specified.