Applies To:
  • CitectSCADA v7.x
  • VijeoCitect v7.x
  • PowerSCADA v7.x

Summary:
 How do I use the  AlarmFirstCatRec and AlarmNextCatRec on a Remote Client?

Solution:

When using the Alarm Record functions (i.e. AlarmFirstTagRec) on a remote client, you will need to use MsgRPC (Message Remote Procedure Call) to the alarm server, as the alarm server holds the alarm information. The alarm identifier will be sent to the remote client as the return value of the MsgRPC function. Refer to the help for MsgRPC cicode function for further information on this function.

Furthermore, the AlarmFirstCatRec or AlarmNextCatRec cicode functions do not work in this method as they are using labels, and you should use _AlarmQueryFirstRec and _AlarmQueryNextRec as alternatives.

The following Cicode function describes the problem and the solution:

FUNCTION TestAlm_Serv()


INT hMsg;

STRING sAlmrec_1,sAlmrec_2,sAlmrec_3,sAlmrec_4;

STRING sAlmrec_5,sAlmrec_6,sAlmrec_7,sAlmrec_8;


        hMsg = MsgOpen("Alarm", 0, 0);

       

        sAlmrec_1 = MsgRPC(hMsg,"AlarmFirstCatRec","50,0,-1",0);   // This returns an empty string and does not function correctly

       // Using MsgRPC works correctly for AlarmFirstTagRec and AlarmGetFieldRec
        sAlmrec_2 = MsgRPC(hMsg,"AlarmFirstTagRec","^"Tag name^"",0);
        sAlmrec_3 = MsgRPC(hMsg,"AlarmGetFieldRec","^"" + sAlmrec_2 + "^",^"DESC^"",0)
       
       // AlarmFirstCatRec and AlarmNextCatRec should be replaced by _AlarmQueryFirstRec and _AlarmQueryNextRec
        sAlmrec_4 = MsgRPC(hMsg,"_AlarmQueryFirstRec","50,4,-1",0);
        sAlmrec_5 = MsgRPC(hMsg,"_AlarmQueryNextRec", "^"" + sAlmrec_4 + "^",50,4,-1",0);

        MsgClose("Alarm", hMsg);

END


Keywords:
 AlarmFirstCatRec, AlarmNextCatRec, MsgRPC

Attachments