18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong> <strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong><br />

Logical Operators<br />

Logical Operators are used to per<strong>for</strong>m logical operations on expressions, and can also be used as bitwise<br />

operators.<br />

Operators Function Example Returns<br />

And Logical And a AND b True only if a and b are both true<br />

Eqv Logical Equivalent a Eqv b True if a and b are the same<br />

Imp Logical Implication a Imp b False only if a is true and b is false otherwise true<br />

Not Logical Not a Not b True if a is false; False if a is true<br />

Or, | Logical Or a OR b True if a or b is true, or both are true<br />

Xor Logical Exclusive Or a Xor b True if a or b is true, but not both<br />

A word of caution about the NOT operator. The NOT operator inverts<br />

boolean “True” and “False” values as expected. However, the NOT<br />

operator can also operate on other data subtypes and IWS data types. The<br />

chart to the right shows the result of the NOT operation on integer (or Real)<br />

values.<br />

Is Operator<br />

The Is operator is used to compare one object variable to another to determine if they reference the<br />

same object. In addition, the Nothing keyword can be used to determine whether a variable contains a<br />

valid object reference..<br />

$ Operator<br />

NOT of<br />

Expression<br />

Expression<br />

True False<br />

False True<br />

3 -4<br />

2 -3<br />

1 -2<br />

0 -1<br />

-1 0<br />

-2 1<br />

-3 2<br />

The $ operator is a very special operator which has been added by <strong>InduSoft</strong>. The $ operator allows<br />

<strong>VBScript</strong> to access IWS tags and built-in functions. IWS tags can be used in expressions similar to<br />

<strong>VBScript</strong> variables. Remember that IWS variable types can be different that <strong>VBScript</strong> data subtypes.<br />

When the $ operator is used, Intellisense (part of <strong>VBScript</strong>) will display all current IWS tags and built-in<br />

functions in a scroll-down menu. The developer can choose from any of these, or add new tags by<br />

typing a unique name. If a new tag name is entered, IWS will then prompt the developer <strong>for</strong> tag type<br />

specifications.<br />

Example: $Temp1 = 100 ‘ Sets IWS tag Temp1 to a value 100<br />

MsgBox $temp1 ‘ Prints the value of IWS tag Temp1<br />

<strong>InduSoft</strong>, Ltd. 99

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!