<?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 Construct a string with single quotes in it in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Construct-a-string-with-single-quotes-in-it/m-p/158217#M33401</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to create a sql statement dynamically from a variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;LET Condition = 'WHERE TimeStart &amp;gt;=' &amp;amp; date(fieldValue('maxdate', 1),'YYYY-MM-DD hh:mm:ss.sss');&lt;BR /&gt;I am further using this variable in a SQL query:&lt;BR /&gt;LOAD a, b, c;&lt;BR /&gt;select a, b, c from ExecTbl&lt;BR /&gt;$(Condition)&lt;BR /&gt;;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;This is giving an error because the generated SQL statement is:&lt;BR /&gt;select a, b, c from ExecTbl WHERE TimeStart &amp;gt;= 2009-08-09 01:02:53.403;&lt;/P&gt;&lt;P&gt;I would like it to be:&lt;BR /&gt;select a, b, c from ExecTbl WHERE TimeStart &amp;gt;= '2009-08-09 01:02:53.403';&lt;/P&gt;&lt;P&gt;Pls advice.&lt;/P&gt;&lt;P&gt;Thnks, Amit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 15 Aug 2009 00:02:34 GMT</pubDate>
    <dc:creator>amit_shetty78</dc:creator>
    <dc:date>2009-08-15T00:02:34Z</dc:date>
    <item>
      <title>Construct a string with single quotes in it</title>
      <link>https://community.qlik.com/t5/QlikView/Construct-a-string-with-single-quotes-in-it/m-p/158217#M33401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to create a sql statement dynamically from a variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;LET Condition = 'WHERE TimeStart &amp;gt;=' &amp;amp; date(fieldValue('maxdate', 1),'YYYY-MM-DD hh:mm:ss.sss');&lt;BR /&gt;I am further using this variable in a SQL query:&lt;BR /&gt;LOAD a, b, c;&lt;BR /&gt;select a, b, c from ExecTbl&lt;BR /&gt;$(Condition)&lt;BR /&gt;;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;This is giving an error because the generated SQL statement is:&lt;BR /&gt;select a, b, c from ExecTbl WHERE TimeStart &amp;gt;= 2009-08-09 01:02:53.403;&lt;/P&gt;&lt;P&gt;I would like it to be:&lt;BR /&gt;select a, b, c from ExecTbl WHERE TimeStart &amp;gt;= '2009-08-09 01:02:53.403';&lt;/P&gt;&lt;P&gt;Pls advice.&lt;/P&gt;&lt;P&gt;Thnks, Amit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2009 00:02:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Construct-a-string-with-single-quotes-in-it/m-p/158217#M33401</guid>
      <dc:creator>amit_shetty78</dc:creator>
      <dc:date>2009-08-15T00:02:34Z</dc:date>
    </item>
    <item>
      <title>Construct a string with single quotes in it</title>
      <link>https://community.qlik.com/t5/QlikView/Construct-a-string-with-single-quotes-in-it/m-p/158218#M33402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Declare another variable,&lt;/P&gt;&lt;P&gt;vSign = '&lt;/P&gt;&lt;P&gt;and then flank your date value with the variable??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt; LET Condition = 'WHERE TimeStart &amp;gt;=' vSign&amp;amp; date(fieldValue('maxdate', 1),'YYYY-MM-DD hh:mm:ss.sss')&amp;amp;vSign;&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2009 00:53:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Construct-a-string-with-single-quotes-in-it/m-p/158218#M33402</guid>
      <dc:creator />
      <dc:date>2009-08-15T00:53:14Z</dc:date>
    </item>
    <item>
      <title>Construct a string with single quotes in it</title>
      <link>https://community.qlik.com/t5/QlikView/Construct-a-string-with-single-quotes-in-it/m-p/158219#M33403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, you can concatenate the function Chr() with 39 as parameter (Chr(39)), this function gives you the ' char&lt;/P&gt;&lt;P&gt;or in a complex case use the replace like this&lt;/P&gt;&lt;P&gt;Let strSQL = ' where company in (#C1#,#C2#)';&lt;BR /&gt;&lt;BR /&gt;Let strSQLv2 = replace(strSQL,'#',Chr(39));&lt;/P&gt;&lt;P&gt;and the result is&lt;/P&gt;&lt;P&gt;strSQLv2 = where company in ('C1','C2')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2009 05:26:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Construct-a-string-with-single-quotes-in-it/m-p/158219#M33403</guid>
      <dc:creator>hector</dc:creator>
      <dc:date>2009-08-15T05:26:19Z</dc:date>
    </item>
    <item>
      <title>Construct a string with single quotes in it</title>
      <link>https://community.qlik.com/t5/QlikView/Construct-a-string-with-single-quotes-in-it/m-p/158220#M33404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Chai and Hector. Suggestions provided by both of you are very useful.&lt;/P&gt;&lt;P&gt;Cheers, Amit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2009 17:02:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Construct-a-string-with-single-quotes-in-it/m-p/158220#M33404</guid>
      <dc:creator>amit_shetty78</dc:creator>
      <dc:date>2009-08-17T17:02:27Z</dc:date>
    </item>
  </channel>
</rss>

