0% found this document useful (0 votes)
47 views

Citect SCADA Help - Converting Legacy AlarmSetQuery Functions - System Model

This document provides examples of converting legacy AlarmSetQuery() functions to the new alarm filter functions introduced in Citect SCADA 7.30. It shows the old v7.20 code using AlarmSetQuery() and what equivalent v7.30 code may look like using the new alarm filter edit functions like AlarmFilterEditOpen(), AlarmFilterEditSet(), and AlarmFilterEditCommit(). Another example is also provided of how the AlarmFilter730() function could be implemented to set a filter on a field name and value.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Citect SCADA Help - Converting Legacy AlarmSetQuery Functions - System Model

This document provides examples of converting legacy AlarmSetQuery() functions to the new alarm filter functions introduced in Citect SCADA 7.30. It shows the old v7.20 code using AlarmSetQuery() and what equivalent v7.30 code may look like using the new alarm filter edit functions like AlarmFilterEditOpen(), AlarmFilterEditSet(), and AlarmFilterEditCommit(). Another example is also provided of how the AlarmFilter730() function could be implemented to set a filter on a field name and value.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1/3/2020 Converting Legacy AlarmSetQuery functions | System Model

System Model > Alarms > Using Custom Alarm Filters > Converting Legacy AlarmSetQuery Functions

Converting Legacy AlarmSetQuery() Functions

With the release of Citect 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 Implementing 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

file:///C:/Program Files (x86)/Schneider Electric/Citect SCADA 2018/Bin/Help/Citect SCADA/Default.htm#Converting_Legacy_AlarmSetQuery_fun… 1/2


1/3/2020 Converting Legacy AlarmSetQuery functions | System Model
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

Published 2018

file:///C:/Program Files (x86)/Schneider Electric/Citect SCADA 2018/Bin/Help/Citect SCADA/Default.htm#Converting_Legacy_AlarmSetQuery_fun… 2/2

You might also like