Applies To:
  • CitectSCADA 1.xx, 2.xx, 3.xx, 4.xx, 5.xx
  • CitectHMI 1.xx, 2.xx, 3.xx, 4.xx, 5.xx

Summary:
When I try to use the AlarmFirstCatRec function in the Kernel Cicode window, it returns an error "Unknown Function" - why is this so? 

Solution:
Some cicode functions are actually macros or labels which are converted into other cicode functions calls by the Citect compiler. If you look in the INCLUDE project under Labels you will see all the cicode functions which are compiled in this way. If you search for AlarmFirstCatRec() you will find it is an label with the expression of

NAME: AlarmFirstCatRec(hCat,nType,hArea=-1)

EXPRESSION: _AlarmQueryFirstRec(hCat,nType,hArea,0)

This means that calls to AlarmFirstCatRec() will be converted into calls to the _AlarmQueryFirstRec() function by the compiler. The Citect Kernel does not do this conversion so if you call the original function you will get the unknown function error.

There is also a second case where this error can occur. The Citect Kernel uses the internal name of the cicode functions which may be slightly different from the user names. The names may be different when the existing cicode function is enhanced and the number of arguments is changed. When this occurs the developers must create a label to make the existing customers project compatible with the new version of the function. So sometimes they rename the internal function to _name and call the label the original name. So if you get this error with a function, try again by using the same name but starting with an underscore (_).

However in your case you have both occurring as the internal name in Citect Version 5.41 is 'AlarmQueryFirstRec' rather than _AlarmQueryFirstRec. I think the function may have had an underscore in a previous version of Citect.

Anyway you may call the AlarmQueryFirstRec() function directly in the kernel, passing a 0 as the extra 4 parameter to get the same effect of calling AlarmFirstCatRec(). If that does not work try adding the extra underscore (_) to the beginning of the name.

 

Keywords:
 

Attachments