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

Loading variable containing a single quote as field in a table

Hi community users,

I found a lot of useful information concerning quotation and escape sequences, but nothing about my quotation problem.

I've a variable containing a text starting with a single quote (chr(39)).

I'm trying to use this variable (within $()) as literal in a Load statement, but as literals should come in single quotes it doesn't work.

Here is my code:

My variable vFile contains a single quote:

The QV parser inserts an Escape sequence trying to solve the problem.

The error comes with following debug information, the literal is starting with a triple single quote:

According to previous information, I would assume that the second and third quote would resolve as Escape sequence, but that doesn't work. My guess is doesn't work because it's at the beginning of the literal.

My simple solution is to replace the single quote Chr(39) by quotation mark Chr(96), that works.

However my style is 'perfect and simple' solutions: so I'm still looking for a better way to solve this issue.

Anyone a better solution?

5 Replies
sunny_talwar

May be use a WildCard?

*s-Gravenhage Factpack 160602.pdf

m_r_de_wit
Contributor III
Contributor III
Author

Hi Sunny,

Thanks for your help. I don't consider this an improvement compared with my replacement with a quotation mark (')

I would like te get the original text string, including the single quote at the first position, into the table field.

Hoping to find someone to solve this.

Kind regards Michel

sunny_talwar

My bad, I thought it was the while you are loading from. But this seems like a field in your file, right? Can you try one of these and see if those help:

['s-Gravenhage Factpack 160602.pdf] as Bestand

or

"'s-Gravenhage Factpack 160602.pdf" as Bestand

Seems like you have already tried the second one, but if you have not, then give them a shot. If it doesn't work, would you be able to share a sample to look at this?

sunny_talwar

Another thing that comes to my mind is, what name does it pick when you do a LOAD *;

May be once you have it loaded, check how QlikView is reading it in the table viewer or within the list of fields you have in your application

marcus_sommer

It's not very nice but if you used an additionally step and putting your variable within a field you could avoid the quotes-trouble. Here a very simplified example:

set z = "'xxxxx";

q:

load * inline [

x

$(z)

];

set y = peek('x', 0, 'q');

load $(y) as a AutoGenerate 1;

- Marcus