<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Pb with quotes in a string in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Pb-with-quotes-in-a-string/m-p/194244#M55224</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you manipulate the variable from the qvs file?&lt;/P&gt;&lt;P&gt;I was able to set up a load like this:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Directory;&lt;BR /&gt;LOAD Test&lt;BR /&gt;FROM&lt;BR /&gt;..\Book1.xls&lt;BR /&gt;(biff, embedded labels, table is Sheet1$)&lt;BR /&gt;WHERE(Replace(Test, Chr(39), '"') = '$(testVar)');&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I had changed testVar to be Let"s Rock.&lt;/P&gt;&lt;P&gt;If you can somehow replace the single-quotes in your variable with double-quotes, this will work. And because you're doing the Replace in the Where clause, your data will still load with the single-quotes.&lt;/P&gt;&lt;P&gt;If you're loading the variable from Excel, you can also use the Replace in the load script:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;LOAD Replace(Test, Chr(39), '"') ...&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Sep 2009 21:15:31 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-09-25T21:15:31Z</dc:date>
    <item>
      <title>Pb with quotes in a string</title>
      <link>https://community.qlik.com/t5/QlikView/Pb-with-quotes-in-a-string/m-p/194239#M55219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;i need to call the filesize('$(filename)') function to test if a file exists.&lt;/P&gt;&lt;P&gt;When the filename or the path has a quote into it, the script fails&lt;/P&gt;&lt;P&gt;And unfortunately i can't change the path name&lt;/P&gt;&lt;P&gt;For example :&lt;/P&gt;&lt;P&gt;set filename="c:\program files\that's my directory\my file.xls";&lt;/P&gt;&lt;P&gt;if isnull( filesize ('$(filename)')) then&lt;/P&gt;&lt;P&gt;exit script;&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;Do you have any idea to solve this issue&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2009 17:08:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pb-with-quotes-in-a-string/m-p/194239#M55219</guid>
      <dc:creator />
      <dc:date>2009-09-22T17:08:07Z</dc:date>
    </item>
    <item>
      <title>Pb with quotes in a string</title>
      <link>https://community.qlik.com/t5/QlikView/Pb-with-quotes-in-a-string/m-p/194240#M55220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The files with the single quotes do not work, because a single quote is the string terminator on your dollar sign expansion. When it hits the single quote in your filename, it thinks it has hit the end of the string. You're expression is looking for the filesize of "c:\program files\that", which I'm assuming doesn't exist.&lt;/P&gt;&lt;P&gt;I tried a bunch of different ways to replace the single quote with something else, but since QlikView uses a single quote as a special character, it is near impossible.&lt;/P&gt;&lt;P&gt;Alternatively, have you tried simply using:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;filesize(filename)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I was able to use that in a test and it worked fine. Here's my load script:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Let filename = 'it' &amp;amp; Chr(39) &amp;amp; 's.txt';&lt;BR /&gt;Let fileSize = filesize(filename);&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;That gave me two variables. filename was "it's.txt" and fileSize was the correct size of the file. As you can see, you can't even create a string in QlikView load script containing a single quote, because QlikView uses it as the string terminator. Chr(39) is a QlikView function that returns a single quote. I'm guessing you are using some other means to populate the filename, so that will not be an issue. Note, I used Lets not Sets, which have slight differences, so you may want to try that (I'm not sure if it matters in your case, but it did in mine since filename use string concatenation).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2009 22:05:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pb-with-quotes-in-a-string/m-p/194240#M55220</guid>
      <dc:creator />
      <dc:date>2009-09-22T22:05:49Z</dc:date>
    </item>
    <item>
      <title>Pb with quotes in a string</title>
      <link>https://community.qlik.com/t5/QlikView/Pb-with-quotes-in-a-string/m-p/194241#M55221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks very much NMiller for your quick and detailed reply.&lt;/P&gt;&lt;P&gt;actually, as a general behaviour, if i directly use filesize(filename) instead of filesize($(filename)) in the script, QV doesn't use the content of the variable but instead tries to find the size of a file which is named filename. So, the filesize function returns null.&lt;/P&gt;&lt;P&gt;i already had this kind of issue before but each time i've found a workaround either by substituing the quote by another character or by chr(39) or by renaming the string. But this time it's not possible, and i must admit that i'm running out of ideas... grrrrrr&lt;/P&gt;&lt;P&gt;any other suggestions ?&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2009 22:36:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pb-with-quotes-in-a-string/m-p/194241#M55221</guid>
      <dc:creator />
      <dc:date>2009-09-22T22:36:53Z</dc:date>
    </item>
    <item>
      <title>Pb with quotes in a string</title>
      <link>https://community.qlik.com/t5/QlikView/Pb-with-quotes-in-a-string/m-p/194242#M55222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post the code in your load script that pertains to this issue?&lt;/P&gt;&lt;P&gt;Here's a sample app I created. It uses Let filename = 'filename';. And then uses the code you posted to check if the filesize is null. It seems to work in this situation. If you reload as it, you won't get the result variable, because the file doesn't exist. If I use the commented out Let, it works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2009 23:34:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pb-with-quotes-in-a-string/m-p/194242#M55222</guid>
      <dc:creator />
      <dc:date>2009-09-22T23:34:14Z</dc:date>
    </item>
    <item>
      <title>Pb with quotes in a string</title>
      <link>https://community.qlik.com/t5/QlikView/Pb-with-quotes-in-a-string/m-p/194243#M55223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello NMiller&lt;/P&gt;&lt;P&gt;finally it works with your syntax, i probably made a mistake...&lt;/P&gt;&lt;P&gt;however it's still a kind of mistery for me&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you again&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i'm still having an issue to solve : how to manage this quote problem when i want to use the variable content into a where clause&lt;/P&gt;&lt;P&gt;for example :&lt;/P&gt;&lt;P&gt;let myVar='Let' &amp;amp; chr(39) &amp;amp; 's rock!';&lt;/P&gt;&lt;P&gt;load field1, field2&lt;/P&gt;&lt;P&gt;from fic.xls&lt;/P&gt;&lt;P&gt;where field2='$(myVar)'&lt;/P&gt;&lt;P&gt;i can't put directly the 'Let' &amp;amp; chr(39) &amp;amp; 's rock!' in the where clause because the string is stored in the variable which is declared outside of the script (in a .qvs file)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2009 19:28:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pb-with-quotes-in-a-string/m-p/194243#M55223</guid>
      <dc:creator />
      <dc:date>2009-09-25T19:28:18Z</dc:date>
    </item>
    <item>
      <title>Pb with quotes in a string</title>
      <link>https://community.qlik.com/t5/QlikView/Pb-with-quotes-in-a-string/m-p/194244#M55224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you manipulate the variable from the qvs file?&lt;/P&gt;&lt;P&gt;I was able to set up a load like this:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Directory;&lt;BR /&gt;LOAD Test&lt;BR /&gt;FROM&lt;BR /&gt;..\Book1.xls&lt;BR /&gt;(biff, embedded labels, table is Sheet1$)&lt;BR /&gt;WHERE(Replace(Test, Chr(39), '"') = '$(testVar)');&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I had changed testVar to be Let"s Rock.&lt;/P&gt;&lt;P&gt;If you can somehow replace the single-quotes in your variable with double-quotes, this will work. And because you're doing the Replace in the Where clause, your data will still load with the single-quotes.&lt;/P&gt;&lt;P&gt;If you're loading the variable from Excel, you can also use the Replace in the load script:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;LOAD Replace(Test, Chr(39), '"') ...&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2009 21:15:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pb-with-quotes-in-a-string/m-p/194244#M55224</guid>
      <dc:creator />
      <dc:date>2009-09-25T21:15:31Z</dc:date>
    </item>
  </channel>
</rss>

