Applies To:
  • CitectSCADA 7.0
  • CitectHMI 7.0

Summary:

Using "variable tags" or "local variables" rather than cicode variables, as arguments with some functions will result in an "incompatible types" error. This error occurs in V7 due to stricter type checking and also a change in behaviour between memory tags and thier replacement "Local variables". In V6 and below the compile error would not occur, however if the code used variable tags it would still not operate correctly, in V6 if the code used memory tags it may have worked. Local variables are not a direct substitute for memory tags in this case.

This is a change in behaviour in V7 as memory tags used to "pretend" to be IO variable tags but they are actually like Cicode tags, whereas local variables are actual IO variable tags local to the IO sub-system.

Example:

sRetValue = StrToLines(String,MaxChars, nLines)

The function takes a string and breaks it in to lines such that words are not
split. The string is returned and the number of lines is places in nLines.

'nLines' is an INT however using a variable tag or local variable of type INT will result in the error. A cicode variable must be used here.

 

Solution:

A cicode variable must be used here. The reason is that a value is passed back via the 'nLines' argument and when variable tags are used in function arguments the tag is evaluated first and its value is passed, not the tag itself. Hence the value of the tag itself cannot be updated and a cicode variable must be used for this to work.

This is unlike where a tag is used in an assignment eg 'sRetValue' above can be a variable tag.

You may encounter this error after upgrade to V7 since in V6 the error would not have occured. The value may not have been updated into the tag but perhaps this was not required in your code. This stricter checking and change in behaviour (memory tag vs local tag) in V7 may mean that you will have to modify your previously functional code. It may also identify for you situations where your cicode was not working as you expected and you were previously unaware.

This situation may affect any function where values are returned via an argument. A list of functions known to work this way follows. Citect is reviewing the help documentation for these functions.

DspGetMouse()
SysTimeDelta()
DspAnGetPos()
TrnGetFormat()
FormGetInst()
FormCurr()
FormGetCurrInst()
TableMath()
TrnGetTable()
TrnSetTable()
MsgRead()
QueRead()
TableLookUp()
TableShift()
SQLFieldInfo()
GraphLine()
TrnGetDefScale()
ComRead()
ComWrite()
QuePeek()
ErrDrv()
PlotLine()
PlotXYLine()
PointWriteArrayLong()
PointWriteArrayReal()
DspRubEnd()
TrnEventGetTable()
TrnEventSetTable()
DspGetAnExtent()
SPCSubgroupSizeGet()
TrnClientInfo()
SPCGetHistogramTable()
SPCGetSubgroupTable()
SPCProcessXRSGet()
SPCSpecLimitGet()
SPCClientTableGet()
FuzzyGetShellValue()
FuzzyGetCodeValue()
_ObjectCallMethod()
_ObjectSetProperty()
_ObjectGetProperty()
ObjectAssociateEvents()
ObjectAssociatePropertyWithTag()
ObjectSaveState()
TrnEventGetTableMS()
TrnEventSetTableMS()
_VbCallRun()
VbCallReturn()
_VbCicodeCallReturn()
StrToLines()
ObjectIsValid()
ObjectToStr()
ObjectHasInterface()
 

Keywords:
 

Attachments