omron — Precedence of VBScript Operators

Appendix: VBScript If VBBoolean is set to 0 , then the project will behave as described above: all VBScript functions and operations will read/write a value of −1 for TRUE to Boolean tags. This is the default setting for projects created with InduSoft Web Studio v6.1+SP3 or earlier and then updated to v6.1+SP4, in order to maintain backward compatibility. If VBBoolean is set to 1 , then VBScript — as it is implemented within IWS — will read/write a value of 1 for TRUE to Boolean tags. (This does not affect Integer or Real tags.) This is the default setting for projects created with InduSoft Web Studio v6.1+SP4 or later. Note:

Be careful when defining a custom property on a Linked Symbol using the # Label :@ Pointer syntax. For example: 'The following statements are valid If $MyBoolean = 1 Then End If If $MyBoolean = True Then End If If #Mne:@MyPointer = True Then End If 'The following statement is invalid If #Mne:@MyPointer = 1 Then End If 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. Precedence of VBScript Operators VBScript has a full range of operators, including arithmetic operators, comparison operators, concatenation operators, and logical operators.

When several operations occur in an expression, each part is evaluated and resolved in a predetermined order called "operator precedence." You can use parentheses to override the order of precedence and force some parts of an expression to be evaluated before others. Operations within parentheses are always performed before those outside. Within parentheses, however, standard operator precedence is maintained. When expressions contain operators from more than one category, arithmetic operators are evaluated first, comparison operators are evaluated next, and logical operators are evaluated last.

Comparison operators all have equal precedence; that is, they are evaluated in the left-to-right order in which they appear. Arithmetic and logical operators are evaluated in the following order of precedence. Page 668 InduSoft Web Studio Arithmetic Comparison Logical Negation (-) Equality (=) Not Exponentiation (^) Inequality ( ) And