Applies To:
  • CitectSCADA

When I use TagWrite, it cuts some of the figures off. For example when I call tagwrite("TestTag", 12.12345) I get the value 12.12300 resulting in my tag. Why does this happen?

When calling tagwrite("TestTag", 12.12345), you are passing in a real, but the function takes a string. Despite the fact that passing in a number is not correct, the compiler will not throw an error, but you will lose precision on the cast from double to string.

Ensure that a string is passed in. The above call should be tagwrite("TestTag", "12.12345"). The function converts the string into the correct format, and then writes it to the variable.

Other things to look at are the format, and the scaling,  both defined in the tag form.

 TagWrite, Format, Precision, ###