<?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 loop through stored procedure with multiple nested loops in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/loop-through-stored-procedure-with-multiple-nested-loops/m-p/471325#M694964</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stored procedure results in 1 row, how do I get all results for this table? with a loop for each input?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Jun 2013 14:06:19 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-06-13T14:06:19Z</dc:date>
    <item>
      <title>loop through stored procedure with multiple nested loops</title>
      <link>https://community.qlik.com/t5/QlikView/loop-through-stored-procedure-with-multiple-nested-loops/m-p/471325#M694964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stored procedure results in 1 row, how do I get all results for this table? with a loop for each input?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 14:06:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/loop-through-stored-procedure-with-multiple-nested-loops/m-p/471325#M694964</guid>
      <dc:creator />
      <dc:date>2013-06-13T14:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: loop through stored procedure with multiple nested loops</title>
      <link>https://community.qlik.com/t5/QlikView/loop-through-stored-procedure-with-multiple-nested-loops/m-p/471326#M694965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Either that or rewrite the stored procedure or wrap the stored procedure in another stored procedure that goes loopy on the database server. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 14:51:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/loop-through-stored-procedure-with-multiple-nested-loops/m-p/471326#M694965</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-06-13T14:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: loop through stored procedure with multiple nested loops</title>
      <link>https://community.qlik.com/t5/QlikView/loop-through-stored-procedure-with-multiple-nested-loops/m-p/471327#M694966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;well i have no db access, so the idea was to use a loop like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop value 1 (startdate - enddate)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; loop value 2 (cluster)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; loop value 3 (location)&lt;/P&gt;&lt;P&gt;load from SP for each day &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end loop 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end loop 2&lt;/P&gt;&lt;P&gt;end loop 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any examples online or personal like these? (SP sends 1 resultrow with 5 columns)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 15:16:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/loop-through-stored-procedure-with-multiple-nested-loops/m-p/471327#M694966</guid>
      <dc:creator />
      <dc:date>2013-06-13T15:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: loop through stored procedure with multiple nested loops</title>
      <link>https://community.qlik.com/t5/QlikView/loop-through-stored-procedure-with-multiple-nested-loops/m-p/471328#M694967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, that should certainly be possible. But performance may not be all that good. I don't know the particulars of odbc/oledb, but calling an sp for every record is sure to have quite a bit more overhead than loading records from a single sql select request.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The loop for the dates is a straightforward&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET startdate = num(date#('01/01/2013','DD/MM/YYYY'));&lt;/P&gt;&lt;P&gt;LET enddate = num(today()); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for date = startdate to enddate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do stuff&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the cluster and location it depends. If the number of values is small you could use string arrays&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET vClusters = "'Cluster1','Cluster2','Cluster3'";&lt;/P&gt;&lt;P&gt;for each cluster in $(vClusters)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do stuff using '$(cluster)' for the current cluster value&lt;/P&gt;&lt;P&gt;next &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the clusters and locations are already loaded in tables you could use the fieldvaluecount function for the field that contains the cluster values (same for the locations field).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for i = 1 to fieldvaluecount('ClusterName')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET cluster = fieldvalue('ClusterName', $(i));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do stuff using '$(cluster)' for the current cluster value&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jun 2013 07:11:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/loop-through-stored-procedure-with-multiple-nested-loops/m-p/471328#M694967</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-06-14T07:11:32Z</dc:date>
    </item>
  </channel>
</rss>

