Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
eclecticfish
Contributor
Contributor

Escape character in expression

Hi im new to qlikview, and im trying to write and expression which is generating an SQL string depending on selected value and such. Then ill use a macro to copy that SQL string to clipboard. It all works really well, beside just this little really annoying detail. The created_by field in the table is in varchar, meaning the string needs single quotation marks around the letters. as my expression works now i comes out like this.

Insert into qv_exclude

(ctrl_id,exclude_val,exclude_column,created_by)

values(294, 3336888.18,2,ABC)

It should come out like this

Insert into qv_exclude

(ctrl_id,exclude_val,exclude_column,created_by)

values(294, 3336888.18,2,'ABC')

With the single quotation marks

I use the a _vOSUser variable to get the name. i managed to escape the first quotation mark but i can get the expression to work.


the part of the that is causing me pain looks like this &','&mid(_vOSUser,13)&')'


if i add another single quote in the end so its &'')' i get this error ///   Error: Garbage after expression: ')'  ///



1 Reply
trdandamudi
Master II
Master II

See if the below link helps:

What is chr(39)? Why it is