Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

Implement Queries that Use Custom Alarm Filters

  • Last UpdatedSep 11, 2025
  • 2 minute read

To implement a query that creates a custom alarm filter, you need to use the following Cicode functions:

The alarms within any query function can also be filtered via AlarmSetInfo set to Type=12 and a named filter (see Named Filters).

Note: If a requested filter is too complex (for example, it contains too many conditions or too many nested brackets), the filter is cleared (no filter is used). If this occurs, the hardware alarm "Too many alarms in filters" is generated on the client components, and a tracelog error message is logged.

Example

You may want to create a query that calls the 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 AlarmFilterEditSet (hndl, "Custom1=conveyor") followed by the AlarmFilterEditCommit(hndl) function will filter your alarm data for "conveyor" information.

The query function you would create would be as follows:


! This query function called FilterCustom1()
! filters alarms by the requested Custom filter 1.
! Only alarms with the requested Custom Filter 1 are displayed.

INT

FUNCTION

FilterCustom1(STRING sValue)

INT iResult=-1, INT iHndl=-1,

STRING sFilter="";

sFilter = "Custom1=" + "^"" + sValue + "^""; iHndl= AlarmFilterEditOpen(21);

IF iHndl <> -1 THEN

iResult = AlarmFilterEditSet(iHndl,sFilter)

IF iResult = 0 THEN

iResult = AlarmFilterEditCommit(iHndl)

END

AlarmFilterEditClose(iHndl)

END

RETURN iResult;

END

Say you then want to create a button on a graphics page that lists current conveyor alarms. You would implement this by applying the custom function to the button.


FilterCustom1("converyor");

You could also create a reset button that clears the current displayed list by canceling the query:

hSession = AlarmFilterEditOpen(21);

AlarmFilterEditSet(hSession, "");

AlarmFilterEditCommit(hSession);

AlarmFilterEditClose(hSession);

You have the choice of calling a specific Cicode function, for example, "Customfield1", with the argument "pumpcontrol", or using a more generic approach with the function "Checkfield" with argument "CUSTOM1= pumpcontrol". In this case, the Cicode function filters the passed string and checks the field specified.

See Also

Implement Alarm Filters Using Cicode

In This Topic
TitleResults for “How to create a CRG?”Also Available in