Subject Re: canOpen firing twice for DMD's query object + unexpected =/==
From Mervyn Bick <invalid@invalid.invalid>
Date Fri, 18 Sep 2020 10:34:50 +0200
Newsgroups dbase.getting-started

On 2020/09/17 03:07, Gaetano wrote:

> In the following code, if I change the "==" operator to "=" in the DO
> CASE block, the first DO CASE clause evaluates to true (i.e. the code
> sees _app.varSQL as being an empty string) and cSQL doesn't get updated
> as I expected it to in the second CASE clause.
>
> I believe that the clause should not evaluate to true because
> _app.cVarSQL is set to "getMissDaysDetails" and doesn't have any
> trailing/inbetween/leading spaces. Any idea why the single "=" is not
> working in that context?
>

This is a known "gotcha". :-)

With EXACT set OFF (the default and recommended setting) the = symbol is
equivalent to "begins with".

According to the help file entry for = all strings begin with an empty
string so ""=_app.cVarSQL will always return true.  It recommends
testing for  _app.cVarSQL=""

The alternative is to use the == exactly equals symbol as you have done
or case empty(_app.cVarSQL)

Mervyn.