<?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 Re: How to handle with Single Quotes in Load Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-handle-with-Single-Quotes-in-Load-Script/m-p/396138#M701665</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It worked for that case specific but when I pass the file name for a macro function, It does not work. Ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Oct 2012 12:48:01 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-10-10T12:48:01Z</dc:date>
    <item>
      <title>How to handle with Single Quotes in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-handle-with-Single-Quotes-in-Load-Script/m-p/396136#M701663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a code similar to this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;For each File in Filelist ('..\source\*.csv')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // some code here, not important for this topic&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call ReadFile('$(File)');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;Next&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code works fine with the file does not have single quote in the name. However, if does, the code fails when I pass the file name to the function ReadFile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to rename the file via a macro vbscript as follows, but It also fails to pass the file name as a parameter to any function because of the single quote.&lt;/P&gt;&lt;P&gt; I also try to use Chr(39), Replace and many functions but one of them works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Macro function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;function renamefile(strFile)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set fso = CreateObject("Scripting.FileSystemObject") &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;newfilename = replace(strFile, chr(39), "`")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fso.MoveFile strFile, newfilename &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set fso = Nothing &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; renamefile = newfilename&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;end function&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone has any idea of how to solve this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Oct 2012 17:44:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-handle-with-Single-Quotes-in-Load-Script/m-p/396136#M701663</guid>
      <dc:creator />
      <dc:date>2012-10-09T17:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle with Single Quotes in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-handle-with-Single-Quotes-in-Load-Script/m-p/396137#M701664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found this thread: &lt;A _jive_internal="true" class="loading active_link" href="https://community.qlik.com/thread/3915" title="http://community.qlik.com/thread/3915"&gt;http://community.qlik.com/thread/3915&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Have you tried Readfile(File) ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: something else you can try is creating a function that first loops through all the files and renames any file that contains a ', so you are sure that afterwards all files will load without problems.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Oct 2012 18:08:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-handle-with-Single-Quotes-in-Load-Script/m-p/396137#M701664</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2012-10-09T18:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle with Single Quotes in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-handle-with-Single-Quotes-in-Load-Script/m-p/396138#M701665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It worked for that case specific but when I pass the file name for a macro function, It does not work. Ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 12:48:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-handle-with-Single-Quotes-in-Load-Script/m-p/396138#M701665</guid>
      <dc:creator />
      <dc:date>2012-10-10T12:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle with Single Quotes in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-handle-with-Single-Quotes-in-Load-Script/m-p/396139#M701666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Igor,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try replacing the single quote with a double quote in the load script and &lt;SPAN style="text-decoration: line-through;"&gt;put it into a variable&lt;/SPAN&gt; submit to function ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each File in FileList ('*.csv')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; newFile = Replace(File,chr(39),chr(34))&amp;nbsp; // replace ' with "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="text-decoration: line-through;"&gt; let x = ReadFile();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; let x = ReadFile(newFile);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... then &lt;SPAN style="text-decoration: line-through;"&gt;recover the variable value in the macro and&lt;/SPAN&gt; change the characters back ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function &lt;SPAN style="text-decoration: line-through;"&gt;ReadFile()&lt;/SPAN&gt; ReadFile(newFile)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="text-decoration: line-through;"&gt;strFile = ActiveDocument.Variables("newFile").GetContent&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReadFile = Replace(strFile.String,chr(34),chr(39))&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end Function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: flipside&#xD;
Corrected method, variables obviously not available during load&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 13:35:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-handle-with-Single-Quotes-in-Load-Script/m-p/396139#M701666</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2012-10-10T13:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle with Single Quotes in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-handle-with-Single-Quotes-in-Load-Script/m-p/396140#M701667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I mde a few changes in my rename file name function and It is working now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2012 13:58:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-handle-with-Single-Quotes-in-Load-Script/m-p/396140#M701667</guid>
      <dc:creator />
      <dc:date>2012-10-10T13:58:08Z</dc:date>
    </item>
  </channel>
</rss>

