Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm loading a script variable, say vS, with a load/peek which I then need to use in a subsequent load/SQL. The example below illustrates the problem using inline/resident rather than SQL data sources, but the issue is the same.
some_metadata:LOAD * INLINE [Sh'ello];temp:NOCONCATENATE LOAD SRESIDENT some_metadata;LET vS = PEEK('S', 0, 'temp');DROP TABLE temp;raw_data:LOAD * INLINE [raw_x,raw_y1,goodbye2,h'ello];data:LOAD raw_x as x, raw_y as yRESIDENT 'raw_data'WHERE raw_y = '$(vS)';This works until S contains a single quote. I'm familiar with decomposing a string and then using '&' concatenation and CHR(39) in some contexts, but I'm not sure what to do in this case.
Thanks for verifying what's happening.
The two ways I've seen for escaping the enclosing characters (single quote in this case) in a language token are: 1) have a different escape character (backslash is common; then to express a backslash you would double the backslash) or 2) double the enclosing character if it appears within the token. QV apparently uses the later method which is just like SQL string constants.
It would be nice to have this information documented in the reference manual.
Everything learned so far applies to the load script. But this isn't the end of my problems. Now try to take the --$(vS)-- and show it in a text box while it contains a single quote. None of the following works:
Any ideas?
It will be
=vS
See attached
Thanks, I misunderstood the reference manual and thought you always had to use dollar expansion with scripting variables.
Sometimes $() is not necessary, usualy on the front end. And, if not for the apostrophe, your last two versions would be working as well.