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

AVEVA™ Plant SCADA

Convert Legacy AlarmSetQuery() Functions

  • Last UpdatedSep 11, 2025
  • 2 minute read

With the release of Plant SCADA 7.30, the AlarmSetQuery() and Query() Cicode functions were replaced with a set of alarm filter functions. If your project uses AlarmSetQuery(), you will need to review and manually replace each instance with the alarm filter edit functions (see Implement Queries that Use Custom Alarm Filters).

Below are examples of v7.20 Cicode and what the v7.30 Cicode may look like with the new alarm filter edit functions.

Conversion examples from v7.20 to v7.30:

v7.20 code:

….

INT resultAlarmSetQuery=0;

// e.g. fieldName = Category, fieldValue = 10

// or fieldName = Tag, fieldValue = DigitalAlarm1

resultAlarmSetQuery =

AlarmSetQuery(21,"AlarmFilter","^""+fieldName+"^",^""+filterValue+"^"");//Obsolete in v7.30

…….

PUBLIC

INT

FUNCTION AlarmFilter

(INT iRecId,

INT iInst,

STRING fieldName,

STRING filterValue)

INT resultFilter=0;

STRING getValue="";

getValue = AlarmGetFieldRec(iRecId, fieldName, iInst);

IF filterValue = getValue THEN

resultFilter = TRUE;

ELSE

// when "*" entered -> all values are accepted

IF filterValue = "*" THEN

resultFilter = TRUE;

ELSE

resultFilter = FALSE;

END

END;

RETURN resultFilter;

END

v7.30 code:

….

INT resultAlarmSetQuery=0;

//AlarmSetQuery(21,"AlarmFilter30","^""+fieldName+"^",^""+filterValue+"^"");Obsolete in 7.30

//replace the above by direct call

resultAlarmSetQuery = AlarmFilter730(fieldName,filterValue);

....

PUBLIC

INT

FUNCTION AlarmFilter730

(STRING fieldName,

STRING filterValue)

INT hndl=-1, resultFilter=-1;

TRING sFilter="";

sFilter = fieldName + "=" + filterValue;

hndl= AlarmFilterEditOpen(21);

IF hndl <> -1 THEN

resultFilter = AlarmFilterEditSet(hndl,sFilter)

IF resultFilter = 0 THEN

resultFilter = AlarmFilterEditCommit(hndl)

END

AlarmFilterEditClose(hndl)

END

RETURN resultFilter;

END

Another example of how this function could be returned:

PUBLIC

INT

FUNCTION AlarmFilter730

(STRING fieldName,

STRING filterValue)

INT hndl;

INT resultFilter=-1;

hndl = AlarmFilterEditOpen(21);

IF hndl <> -1 THEN

resultFilter = AlarmFilterEditSet(hndl, fieldName)

IF resultFilter = 0 THEN

resultFilter = AlarmFilterEditAppend(hndl, "=^"")

END

IF resultFilter = 0 THEN

resultFilter = AlarmFilterEditAppend(hndl, filterValue)

END

IF resultFilter = 0 THEN

resultFilter = AlarmFilterEditAppend(hndl, "^"")

END

IF resultFilter = 0 THEN

resultFilter = AlarmFilterEditCommit(hndl)

END

AlarmFilterEditClose(hndl)

END

RETURN resultFilter;

END

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