<?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: Loop within the load statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Loop-within-the-load-statement/m-p/884299#M308391</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Peter!&lt;/P&gt;&lt;P&gt;This approach gives me some flexibility, but adds some extra challenges (filtering commented lines, extra lines between variables, etc). But it looks like a path to the right direction. Will try to adjust it to my scenario.&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;Regards,&lt;/P&gt;&lt;P&gt;Vladimir &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Jun 2015 18:51:44 GMT</pubDate>
    <dc:creator>vlad_komarov</dc:creator>
    <dc:date>2015-06-12T18:51:44Z</dc:date>
    <item>
      <title>Loop within the load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-within-the-load-statement/m-p/884297#M308389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a data table that contains strings loaded from TXT file. These strings are actually variables' definitions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;let vTaskAssignedToRegion= '=GetFieldSelections(TASK_ASSIGNED_TO_REGION)';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;let vStartCount = '=sum({&amp;lt;SessionDateNum={"&amp;gt;$(=Num(Today()-90))"}, User-={"Anonymous"}&amp;gt;} Session_Start_Count)';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loading these strings produces one challenge: some variables are defined on multiple lines in the input file:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;let vStartCount = '=sum(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;lt;SessionDateNum={"&amp;gt;$(=Num(Today()-90))"},&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; User-={"Anonymous"}&amp;gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Session_Start_Count)';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was thinking about loading strings between "let" and ";" &lt;SPAN style="font-size: 13.3333330154419px;"&gt;sub-strings and concatenate them into one result record.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;What's the most efficient way to do that? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;The only way I can see now is to organize a loop within the load script and concatenate strings from "let" line until the ";" character is reached in sequential strings load. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;I am not sure if it's possible,&amp;nbsp; first of all, and it does not look like a most efficient way to do it anyway. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Any suggestions?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Vladimir &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 18:08:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-within-the-load-statement/m-p/884297#M308389</guid>
      <dc:creator>vlad_komarov</dc:creator>
      <dc:date>2015-06-12T18:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Loop within the load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-within-the-load-statement/m-p/884298#M308390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could convince QlikView that CR + LF is not end of record by telling it it that the record is actually 1024 lines long or whichever max size that is higher than you will ever expect in your input file. Then QlikView happily loads the entire text file into one single string. Then you could break it down into lines by semicolons instead by using SubField().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is as simple as this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SubField( [@1:n] , ';' ) AS Statements&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;myTextFile.txt&lt;/P&gt;&lt;P&gt;(fix, codepage is 1252, record is 1024 lines);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 18:24:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-within-the-load-statement/m-p/884298#M308390</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2015-06-12T18:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: Loop within the load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-within-the-load-statement/m-p/884299#M308391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Peter!&lt;/P&gt;&lt;P&gt;This approach gives me some flexibility, but adds some extra challenges (filtering commented lines, extra lines between variables, etc). But it looks like a path to the right direction. Will try to adjust it to my scenario.&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;Regards,&lt;/P&gt;&lt;P&gt;Vladimir &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 18:51:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-within-the-load-statement/m-p/884299#M308391</guid>
      <dc:creator>vlad_komarov</dc:creator>
      <dc:date>2015-06-12T18:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Loop within the load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-within-the-load-statement/m-p/884300#M308392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can read them as regular lines, concat into a single line and then subfield by ';'. You might want to make your subfield delim ';' &amp;amp; chr(10) to avoid mistaking embedded ';' as the end of the statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subfield(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;AllStatements, ';') as Statement&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px; font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; concat(&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;Statements&lt;/SPAN&gt;,'',RecNo()) as AllStatements&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD&amp;nbsp; Statements&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FROM&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;myTextFile.txt .....&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://masterssummit.com/" rel="nofollow"&gt;http://masterssummit.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://robwunderlich.com/" rel="nofollow"&gt;http://robwunderlich.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 19:53:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-within-the-load-statement/m-p/884300#M308392</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2015-06-12T19:53:08Z</dc:date>
    </item>
  </channel>
</rss>

