Hi there!I have a Script Library with this simple piece of code:
Dim x as Boolean
x = False
if x = False Then
Print “False”
else
Print “True”
End if
Quite simple, right?
For users having a fat Notes client version 6.5 the printout is “False”
But, for users having a thin Notes client version 5.0.12 the printout is “True”!!!
Can someone explain to me why this simple logic fails? Is the memory/cache shares between users in some way?
TIA
// mats
Subject: Basic logic fails due to clients?
Boolean datatype was introduced in R6. So if users access that database from R5 it would not work. Use Variant datatype instead.
cheers !!
Ashish
Subject: RE: Basic logic fails due to clients?
Why variant? Integer makes more sence.
Subject: RE: Basic logic fails due to clients?
No, it doesn’t. It’s a bad pre-bool VB practice that has spread to Notes. Boolean Variants are not identical to integers, and that makes a difference in Boolean operations, particularly in And and Or, which are bitwise operators. Unexpected, intermittent logic problems can often be traced to the undisciplined use of Integers for Boolean values.
Subject: RE: Basic logic fails due to clients?
Stan, I used to do this and never noticed any problems with bitwise operations:
dim flag as integer, flag2 as integer
flag = false '<— use keyword, not actual number like -1 or 0
flag2 = false
bunch of code…sets flag and flag2 to either true or false
if flag or flag2 then
if Not(flag) and flag2 then
I think as long as you use the keywords for assigning the true/false value to the integer, you are safely protected from strange bitwise operations occurring.
Subject: RE: Basic logic fails due to clients?
The problem is consistency – people get into the bad habit of using integer values (1 or -1 and 0), which can lead to bitwise problems down the road. Using Variants (or Bools) and keywords is simply having safer cybersex.
Subject: Basic logic fails due to clients?
define x as a variant - R5 doesn’t get boolean