Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This is seemingly simple but is causing me headache:
I have a variable which can be empty or have a value, i.e.
set myvar = ;
or
set marvar = 1;
I'm assuming that elsewhere I can test
if '$(myvar)' then or if isnull('$(myvar)') then
but this isn't working. I've tried many ways but didn't find a solution. I get an error message "script line error if ... then". $(#myvar) crashes script without any error.
On top of that putting msgbox('$(ScriptErrorDetails)') doesn't work, MsgBox isn't recoginzed in the script.
I have a feeling that I'm missing something very basic. Any thoughts?
Try
if Trim('$(myvar)') = '' or isnull('$(myvar)') then
Normally you do not need the apostrophs, they are only needed when explicitly you need to declare a string. Within the normal statements in the script you also do not need to use the $(...), just the name should do it. Thus your statement should read
IF myvar = 1 THEN ... ELSE ... END IF
n.b.: If you can avoid it, would not have a variable containing NULL-value. It is better to have it reading either 0 or 1.
HTH
Peter