01-08-2019 11:13 AM
I have setup a dialogue box with two radio buttons and allocated B1 as a variable for it, having a value of either 0 or 1 depending on the choice of radio button.
I then use Select Case to examine the value of B1 and find that Case 0 and Case 1 doesn't work, but Case False and Case True does. My code is:
B1=1
Call SUDDefLoad(AutoDrvUser&"Actions.sud")
Call SUDDlgShow("Analysis")
if DlgState = "IDOk" then Select Case B1 Case False Call ScriptStart("GetData") Case True Call ScriptStart("GetContData") End Select else Flag = 0 Call Err.Raise (-1) 'Autoquit end if
A similar dialogue box written by a colleague uses the same concept for the radio buttons and variable, but his code works because he uses an If statement to determine the value of B1. His code is:
B1=0 Call SUDDlgShow("Decimate") if DlgState <> "IDOk" then Call Err.Raise (-1) 'Autoquit end if If B1=0 Then NoPts = Val(T1) Else NoPts = L2/Val(T1) End If
Why the difference in behaviour with the use of B1?
Thanks,
Simon.
Solved! Go to Solution.
01-08-2019 01:09 PM
would it ever be true?
01-09-2019 08:11 AM
The confusion deepens. You seem to have proved that B1 cannot use 0 or 1, and must use True or False instead.
I tested my colleague's code and it seems you are correct. His code only worked because he used "If B1=0" and "Else", which is the only case that turns out true in your experiment!! I have changed his code to use True and False.
However, the DIAdem help files state that a Boolean variable type can take the values TRUE, FALSE or "YES", "NO" or 1, 0. See here for example in 2018 online help. Not at all helpful!!
Regards,
Simon.
01-09-2019 08:47 AM
The docs are fooling us... the only "truthy" value i found was -1