Applies To:
  • CitectSCADA 1.xx 2.xx 3.xx 4.xx

Summary:
If the arguments, Pen and/or AN, are invalid TrnGetScaleStr() will not set an error for the invalid arguments. However, TrnGetScale function sets the invalid argument error for incorrect arguments. Is there a workaround to get TrnGetScaleStr function to set the invalid argument error? 

Solution:
CIT has confirmed this to be a problem in all Citect for Windows versions prior to version 5. This problem has been fixed in version 5.

TrnGetScaleStr() user function returns <na> when thepen is invalid and the user should check for this return value.

The workaround to the problem is to write a new Cicode function that calls TrnGetScale function and converts the result to string. TrnGetScale function will set the invalid argument error.

STRING
FUNCTION
TrnGetScaleString(INT hAn, INT hPen, INT percent)
   REAL scale;

   scale = TrnGetScale(hAn, hPen, percent);
   IF IsError() = 0 THEN
      RETURN RealToStr(scale,8,3);
   ELSE
      RETURN "<na>";
   END
END

 

Keywords:
 

Attachments