<?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 Concatenate SQL string with variables and special characters in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Concatenate-SQL-string-with-variables-and-special-characters/m-p/1256702#M397019</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am want to feed the following query with content via variables in the load script:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;SELECT &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; $(vSQL_Columns)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FROM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; $(vDatabase)$(vTableName)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; $(vJoinStatement)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;WHERE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; $(vWhereClause_fin)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; $(vIncrementalDate) &amp;lt; '$(vPrevMthStart)'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;This is all straight forward until I want to parse the $(vWhereClause). The where-clause obviously contains special characters like &amp;lt;, &amp;gt; and =.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;vWhereClause_fin is populated and assembled as follows. &lt;SPAN style="font-size: 13.3333px;"&gt;It should translate into "T1.Column1 &amp;lt; 14 and T1. Column1 &amp;gt; 15 AND".&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD colspan="1"&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;LET vWhereClause&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD colspan="1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;=&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD colspan="1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;"T1.Column1 " &amp;amp; chr(60) &amp;amp; " 14 AND T1.Column1 " &amp;amp;chr(62) &amp;amp; " 15&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;";&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LET vWhereClause_fin&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;=&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;If($(vWhereClause)="","",$(vWhereClause) &amp;amp; " AND ");&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LET vWhereClause_fin&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;=&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;If($(vDebug)=1,$(vWhereClause_fin) &amp;amp; $(vDebugWhereClause) &amp;amp; " AND ",$(vWhereClause_fin));&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;As soon as I try that, I get a script error in return. What am I missing?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;Thanks for your time and help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;Henning&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Jan 2017 13:31:47 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-01-30T13:31:47Z</dc:date>
    <item>
      <title>Concatenate SQL string with variables and special characters</title>
      <link>https://community.qlik.com/t5/QlikView/Concatenate-SQL-string-with-variables-and-special-characters/m-p/1256702#M397019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am want to feed the following query with content via variables in the load script:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;SELECT &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; $(vSQL_Columns)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FROM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; $(vDatabase)$(vTableName)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; $(vJoinStatement)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;WHERE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; $(vWhereClause_fin)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; $(vIncrementalDate) &amp;lt; '$(vPrevMthStart)'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;This is all straight forward until I want to parse the $(vWhereClause). The where-clause obviously contains special characters like &amp;lt;, &amp;gt; and =.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;vWhereClause_fin is populated and assembled as follows. &lt;SPAN style="font-size: 13.3333px;"&gt;It should translate into "T1.Column1 &amp;lt; 14 and T1. Column1 &amp;gt; 15 AND".&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD colspan="1"&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;LET vWhereClause&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD colspan="1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;=&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD colspan="1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;"T1.Column1 " &amp;amp; chr(60) &amp;amp; " 14 AND T1.Column1 " &amp;amp;chr(62) &amp;amp; " 15&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;";&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LET vWhereClause_fin&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;=&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;If($(vWhereClause)="","",$(vWhereClause) &amp;amp; " AND ");&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LET vWhereClause_fin&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;=&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;If($(vDebug)=1,$(vWhereClause_fin) &amp;amp; $(vDebugWhereClause) &amp;amp; " AND ",$(vWhereClause_fin));&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;As soon as I try that, I get a script error in return. What am I missing?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;Thanks for your time and help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;Henning&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2017 13:31:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Concatenate-SQL-string-with-variables-and-special-characters/m-p/1256702#M397019</guid>
      <dc:creator />
      <dc:date>2017-01-30T13:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate SQL string with variables and special characters</title>
      <link>https://community.qlik.com/t5/QlikView/Concatenate-SQL-string-with-variables-and-special-characters/m-p/1256703#M397020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use single quotes when referring to string variable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE style="border: 0px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;TBODY style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD colspan="1" style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: 'courier new', courier;"&gt;LET vWhereClause&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD colspan="1" style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;=&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD colspan="1" style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;"T1.Column1 " &amp;amp; chr(60) &amp;amp; " 14 AND T1.Column1 " &amp;amp;chr(62) &amp;amp; " 15&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;";&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;LET vWhereClause_fin&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;=&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;If($(vWhereClause)="","",'$(vWhereClause)' &amp;amp; " AND ");&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;LET vWhereClause_fin&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;=&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;If($(vDebug)=1,'$(vWhereClause_fin)' &amp;amp; '$(vDebugWhereClause)' &amp;amp; " AND ",'$(vWhereClause_fin)');&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2017 13:50:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Concatenate-SQL-string-with-variables-and-special-characters/m-p/1256703#M397020</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2017-01-30T13:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate SQL string with variables and special characters</title>
      <link>https://community.qlik.com/t5/QlikView/Concatenate-SQL-string-with-variables-and-special-characters/m-p/1256704#M397021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lovely, thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2017 13:52:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Concatenate-SQL-string-with-variables-and-special-characters/m-p/1256704#M397021</guid>
      <dc:creator />
      <dc:date>2017-01-30T13:52:56Z</dc:date>
    </item>
  </channel>
</rss>

