Applies To:
  • CitectSCADA 5.xx, 6.xx

After upgrading a project to a newer version of Citect, I have found that some CiCode functions (eg AlarmGetFieldRec) no longer work and I am given the error Unknown Function. When I look the function up in the help, I find it is still there. A new parameter has been added to the function according to the help, however it says that the new parameter will automatically default to some value and I therefore shouldn't need to modify my functions. What's going on?

You will find that you are most likely either calling your function from the kernel (as in testing it and getting a failure) or that you are using it via the CTAPI. The way the CiCode engine works is that during the compile process, these functions normally get resolved correctly to the new function prototype (with added parameters) and are able to cope without the additional parameter being added where you call it, however using the CTAPI or the kernel, does not allow the compiler to resolve this.

The solution invariably is as simple as placing an underscore _ in front of your function when you call it. eg _AlarmGetFieldRec()
This is how the new function protype is named and it should work in this format. Yo won't need to add the extra parameter/s if you call it in this way. Otherwise, you can simply add the parameter in your call and call the function as per normal without the underscore character.