Applies To:
  • CitectSCADA 5.xx

Summary:
Using alarm function such as AlarmFirstCatRec() you specify the area number in which to search. If you specify -1, it searches all areas the current logged in user has access to; if you specify 0, it searches all alarms that do not have an area number; and if you specify any other number from 0 to 255, it searches only that specific area. How can I get it to search all alarm areas regardless of the current user's allowed security areas? 

Solution:
The Group functions may be used to pass multiple areas to the Alarm functions simultaneously. The following function demonstrates this. First, it creates a group that consists of a list of numbers from 0 to 255. It then passes the group handle to the AlarmxxxCatRec functions in place of the Area number. To demonstrate that it worked, it logs some information about each alarm found to the Citect Kernel Window. (Use the command DspKernel(1) to display the Kernel.)
FUNCTION 
AreaSearch()
	INT iRec;
INT hGrp;

hGrp = GrpOpen("MyGrp", 1);
StrToGrp(hGrp, "0..255");
	 iRec = AlarmFirstCatRec(0, 0, hGrp); 
	 WHILE iRec <> -1 DO 
TraceMsg("Rec:" + iRec:# + " Alarm:" + AlarmGetFieldRec(iRec, "Tag", 0));
iRec = AlarmNextCatRec(iRec, 0, 0, hGrp);
END

GrpClose(hGrp);
END
 

Keywords:
 

Attachments