<?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 Problem with string literals in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268659#M710870</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Can you tell me what query oracle will accept in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I will try to make it through the Qlikview.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 13 Aug 2011 04:46:28 GMT</pubDate>
    <dc:creator>kaushiknsolanki</dc:creator>
    <dc:date>2011-08-13T04:46:28Z</dc:date>
    <item>
      <title>Problem with string literals</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268656#M710867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sometimes I am using QC to create SQL strings to be send to an Oracle-DB. It becomes often difficult when the string contains characters that can be interpreted by Oracle.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The current problem (as anexample and attached):&lt;/P&gt;&lt;P&gt;﻿﻿﻿&lt;/P&gt;&lt;P&gt;﻿// Load data from data source&lt;/P&gt;&lt;P&gt;CommentsFromDataSource:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Comments&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; That&lt;/P&gt;&lt;P&gt;] ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// concat into one field&lt;/P&gt;&lt;P&gt;AllCommentsTogether:&lt;/P&gt;&lt;P&gt;Load Distinct&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; concat(distinct Comments, '; ') as AllComments&lt;/P&gt;&lt;P&gt;Resident&amp;nbsp; CommentsFromDataSource ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// assign to variable&lt;/P&gt;&lt;P&gt;LET vAllComments = chr(39)&amp;amp;peek('AllComments')&amp;amp;chr(39) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// use variable in insert string&lt;/P&gt;&lt;P&gt;InsertString:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'insert into TABLE (Field) value ($(vAllComments));' as InsertString&lt;/P&gt;&lt;P&gt;Autogenerate (1) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result I want to get is: insert into TABE (Field) value ('This; That');&lt;/P&gt;&lt;P&gt;What I get is: insert into TABLE (Field) value (''This; That'');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wih duplicated literals which are not accepted by Oracle.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any Idea how to tell QV not to duplicate the literal when adding the string from the variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2011 11:46:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268656#M710867</guid>
      <dc:creator />
      <dc:date>2011-08-12T11:46:37Z</dc:date>
    </item>
    <item>
      <title>Problem with string literals</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268657#M710868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Load data from data source&lt;/P&gt;&lt;P&gt;CommentsFromDataSource:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Comments&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; That&lt;/P&gt;&lt;P&gt;] ;&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;// concat into one field&lt;/P&gt;&lt;P&gt;AllCommentsTogether:&lt;/P&gt;&lt;P&gt;Load Distinct&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; concat(distinct Comments, '; ') as AllComments&lt;/P&gt;&lt;P&gt;Resident&amp;nbsp; CommentsFromDataSource ;&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;// assign to variable&lt;/P&gt;&lt;P&gt;LET vAllComments = chr(39) &amp;amp; peek('AllComments') &amp;amp; chr(39);&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;// use variable in insert string&lt;/P&gt;&lt;P&gt;InsertString:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'insert into TABLE (Field) value ('&amp;amp; chr(39) &amp;amp; $(vAllComments)&amp;amp; chr(39) &amp;amp;');' as InsertString&lt;/P&gt;&lt;P&gt;Autogenerate 1 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2011 12:01:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268657#M710868</guid>
      <dc:creator>kaushiknsolanki</dc:creator>
      <dc:date>2011-08-12T12:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with string literals</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268658#M710869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Kaushik,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes this works fine in the simple example, thank you. Now a bit more advanced: As Oracle does not like all cahracters in a text string I think I have to replace them in advance with the corresponding chr(xx) as in QV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;xCommentsFromDataSource_t0:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xComments&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This &amp;amp; That&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Today &amp;amp; Tomorrow&lt;/P&gt;&lt;P&gt;] ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CommentsFromDataSource:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; replace( xComments, chr(38), chr(39)&amp;amp;'||chr(38)||'&amp;amp;chr(39) ) as Comments&lt;/P&gt;&lt;P&gt;RESIDENT xComentsFromDataSource_t0 ;&lt;/P&gt;&lt;P&gt;DROP TABLE ﻿xCommentsFromDataSource_t0 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AllCommentsTogether:&lt;/P&gt;&lt;P&gt;LOAD DISTINCT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; concat( distinct Comments, '; ') as AllComments&lt;/P&gt;&lt;P&gt;RESIEDENT CommentsFromDataSource ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vAllComments = chr(39)&amp;amp;peek('AllComments')&amp;amp;chr(39) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;InsertString:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'insert into TABLE (Field) value ($(vAllComments));' as InsertString&lt;/P&gt;&lt;P&gt;AUTOGENERATE (1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This results in: insert into TABLE(Field) value (''This ''||chr(38)||'' That; Today ''||chr(38)||'' Tomorrow'');&lt;/P&gt;&lt;P&gt;with double literals before/after the ||&lt;/P&gt;&lt;P&gt;instead of insert into TABLE (Field) value (This '||chr(38)||' THAT; Today.... &lt;/P&gt;&lt;P&gt;what would be needed for Oracle. In this case adding the chr(39) before/after the variable doesn't help because the other double literals are no affected and anyway, the script crashes...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any further ideas ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Again&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2011 12:40:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268658#M710869</guid>
      <dc:creator />
      <dc:date>2011-08-12T12:40:01Z</dc:date>
    </item>
    <item>
      <title>Problem with string literals</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268659#M710870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Can you tell me what query oracle will accept in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I will try to make it through the Qlikview.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Aug 2011 04:46:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268659#M710870</guid>
      <dc:creator>kaushiknsolanki</dc:creator>
      <dc:date>2011-08-13T04:46:28Z</dc:date>
    </item>
    <item>
      <title>Problem with string literals</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268660#M710871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oracle would accept &amp;lt; insert into TABLE (Field) value ('This '||chr(38)||' That; Today '||chr(38)||' Tomorrow'); &amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 07:45:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268660#M710871</guid>
      <dc:creator />
      <dc:date>2011-08-15T07:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with string literals</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268661#M710872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oracle would accept &amp;lt; insert into TABLE (Field) value ('This '||chr(38)||' That; Today '||chr(38)||' Tomorrow'); &amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 07:46:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268661#M710872</guid>
      <dc:creator />
      <dc:date>2011-08-15T07:46:39Z</dc:date>
    </item>
    <item>
      <title>Problem with string literals</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268662#M710873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Load data from data source&lt;BR /&gt;xCommentsFromDataSource_t0:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt; xComments&lt;BR /&gt; This &amp;amp; That&lt;BR /&gt; Today &amp;amp; Tomorrow&lt;BR /&gt;] ;&lt;/P&gt;&lt;P&gt;CommentsFromDataSource:&lt;BR /&gt;LOAD&lt;BR /&gt; replace(xComments, chr(38), chr(39)&amp;amp;'||chr(38)||'&amp;amp;chr(39)) as Comments&lt;BR /&gt;RESIDENT xCommentsFromDataSource_t0 ;&lt;BR /&gt;// Drop table xCommentsFromDataSource_t0 ;&lt;/P&gt;&lt;P&gt;// concat into one field&lt;BR /&gt;AllCommentsTogether:&lt;BR /&gt;Load distinct &lt;BR /&gt; concat( distinct Comments, ';') as AllComments&lt;BR /&gt;Resident CommentsFromDataSource ;&lt;/P&gt;&lt;P&gt;// assign to variable&lt;BR /&gt;LET vAllComments = peek('AllComments',0,'AllCommentsTogether') ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// use variable in insert string&lt;BR /&gt;InsertString:&lt;BR /&gt;LOAD&lt;BR /&gt; 'insert into TABLE (Field) value ($(vAllComments));' as InsertString&lt;BR /&gt;Autogenerate (1) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Aug 2011 05:01:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268662#M710873</guid>
      <dc:creator>kaushiknsolanki</dc:creator>
      <dc:date>2011-08-16T05:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with string literals</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268663#M710874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kaushik,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for thinking aboutit again - but unfortunately the result is the same. It seems, that QV dublicates every literal in a variable when the variable is inserted in a string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The way to this solve in my example seems to be to replace the literals created by QV with anohter statement like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;InsertString:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; replace( InsertString, chr(39)&amp;amp;chr(39), chr(39) ) as InsertString ;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'insert into TABLE (Field) value ($(vAllComments));' as Insert String&lt;/P&gt;&lt;P&gt;Autogenerate (1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course this can be done in one line as well...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Aug 2011 08:34:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-string-literals/m-p/268663#M710874</guid>
      <dc:creator />
      <dc:date>2011-08-16T08:34:46Z</dc:date>
    </item>
  </channel>
</rss>

