Boolean tags and Boolean variables

By default, Boolean tags (i.e., project tags of Boolean type) in InduSoft Web Studio are handled differently than Boolean variables in VBScript. The Boolean states of FALSE and TRUE have the same meanings, but the numerical values of TRUE are different, as shown in the table below:
Boolean state Numerical value in a…
IWS project tag VBScript variable
FALSE 0 0
TRUE 1 (or non-zero) −1
Note: False and True are reserved as keywords in VBScript.

This can cause problems during run time as logical and arithmetic operations — especially the NOT operator — might change tag values in unexpected ways. To prevent these problems and ensure that Boolean tags have the correct values at all times, the VBScript interface in InduSoft Web Studio has been modified to preprocess Boolean tags and handle them like Boolean variables. In other words, while a Boolean tag has an actual value of 1 in the tags database, it is handled as if it has a value of -1 in VBScript so that you can perform operations using both Boolean tags and Boolean variables.

This modification was done in a previous version of InduSoft Web Studio — specifically, in InduSoft Web Studio v6.1+SP4. Projects that were developed with earlier versions of InduSoft Web Studio and then upgraded to the latest version have not been modified, in order to maintain backward compatibility. If you developed your project with an earlier version of InduSoft Web Studio, you can do the modification yourself by manually editing your project file (projectname.APP) to add the following entry:
  [Script]  VBBoolean=1  

After you do this, however, you must thoroughly test your project to make sure that your VBScript code still behaves as expected.

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  

Boolean tags and Boolean variables