<< Click to Display Table of Contents >>
Boolean Values |
In VBScript, 0 (zero) is equal to False and any other value different from zero is considered as True. As an example, consider a Tag representing a digital input or output, therefore its values are 0 (zero) or 1 (one). When using Tag values for Links with Boolean-type properties, Elipse Power considers the values indicated on the next table.
Tag value for Boolean data types
Tag |
VBScript |
---|---|
0 |
False |
1 |
True |
When using a NOT command, Elipse Power considers the values indicated on the next table.
Tag value with a NOT command
Tag |
NOT Tag |
VBScript |
---|---|---|
0 |
-1 |
True |
1 |
-2 |
True |
Therefore, NOT of 1 (one) is not False, because its value is not equal to 0 (zero). In case users want to use a NOT command, first convert a Tag value to a Boolean using the CBool method.
Converting Tags using the CBool method
Tag |
CBool(Tag) |
NOT CBool(Tag) |
---|---|---|
0 |
False |
True |
1 |
True |
False |
Using the CBool method
Another option is to work with Tag's Bit00 property, which is already a Boolean property, instead of working with Tag's Value property.
Using the Bit00 property