Writing Real Values to Integer Tags

By default, a Real (i.e., floating point) value is truncated at the decimal point when it is written to an Integer tag. This behavior is the same in both the Built-in Scripting Language and in VBScript.

You can change this behavior in VBScript, however, by disabling the “TruncRealToInt” runtime setting. To do this, edit your project file (project_name.app) to change the following line:
  [Script]  TruncRealToInt=value  

If TruncRealToInt is set to 1, then the project will behave as described above: Real values will be truncated at the decimal point without rounding. (For example, a value of 5.56 will be written as 5 to an Integer tag.) This is the default setting for projects created with InduSoft Web Studio v6.1+SP4 or earlier and then updated to v6.1+SP5, in order to maintain backward compatibility.

If TruncRealToInt is set to 0, then VBScript functions and operations will round Real values to the nearest integer. (For example, a value of 5.56 will be written as 6 to an Integer tag.) This is the default setting for projects created with InduSoft Web Studio v6.1+SP5 or later.

Note: This setting only affects the behavior of VBScript in IWS. It does not affect the behavior of the Built-in Scripting Language.

Writing Real Values to Integer Tags