parentheses within string break value()
J. Landman Gay
jacque at hyperactivesw.com
Mon Oct 26 17:29:51 EDT 2015
On 10/26/2015 3:25 PM, Dr. Hawkins wrote:
> There is a custom property (call it theProp) with a value like
>
> "SELECT foo FROM " & tableName & " WHERE (bar > 7) AND (animal<>'cat');"
>
>
>
> So those quotes and & are in the string to be evaluated.
>
> My understanding of parsing is that the first piece should evaluate to
>
> SELECT foo FROM
>
>
> the second to
>
> SELECT foo FROM
>
>
> and the third to
>
> WHERE (bar > 7) AND (animal<>'cat');
>
>
> and when concatenated produce a string of
>
> SELECT foo FROM theRealTableName WHERE (bar > 7) AND (animal<>'cat');
>
> That is, I should get three strings, the first and last literals, and the
> middle from evaluation of the variable name, which in turn should
> concatenate by the &.
>
> Instead, though, the quotation marks in the third string are ignored, and
> instead of treating it as as string literal, an attempt is made to evaluate
> it.
I'd use the merge command here. Make a custom property like this:
SELECT foo FROM [[theRealTableName]] WHERE [[compare1]] AND [[compare2]];
In the script:
put "(bar > 7)" into compare1
put "(animal<>'cat')" into compare2
put "realName" into theRealTableName
put merge(the cProp of me) into tCmd
revExecuteSQL tID,tCmd
You may need to add some quotation marks somewhere in there.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list