Applies To:
  • CitectSCADA v7.0, CitectSCADA v7.1

Summary:
TagRead() does not round the decimal places of the return value as defined in the "Format" field of the variable tag form.



This used to work up to CitectSCADA version 6.0 but not in CitectSCADA version 7.0 and 7.1?

Solution:
 
You can use this workaround to accomplish the same functionality:

Function:

REAL

FUNCTION

TagReadFmt

 

(STRING stag)

 

 

 

 

REAL value = 0;

INT fmt = 0;

INT dec = 0;

fmt = TagInfo(stag,8);

dec = (fmt BITAND 0xff00) / 0xff;

value = Round(TagRead(stag),dec); RETURN value;

 

 

 

 

END

 - The above function is generic, so call this instead of the TagRead() with the argument as the tag name (of type string).

 - Return value of the function, which is the current value of the tag is rounded to the decimal places specified in the "Format" field of the variable tag form.


Keywords:
 TagRead, format

Attachments