<?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 through a data set in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Loop-through-a-data-set/m-p/2440740#M97297</link>
    <description>&lt;P&gt;The loop for multiple sql isn't quite clear for me but you may use something like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;for i = 0 to noofrows('Variables') - 1
   vNaam = peek('Naam', $(i), 'Variables');
   vVar1 = peek('Var1', $(i), 'Variables');
   vVar2 = peek('Var2', $(i), 'Variables');
   vVar3 = peek('Var3', $(i), 'Variables');
next&lt;/LI-CODE&gt;
&lt;P&gt;which would assign the field-values in each iteration to the variables - which you could apply within the sql-statements like: $(vVar1) or '$(vVar1)' depending if the content is a number or a string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Apr 2024 15:24:18 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2024-04-12T15:24:18Z</dc:date>
    <item>
      <title>Loop through a data set</title>
      <link>https://community.qlik.com/t5/App-Development/Loop-through-a-data-set/m-p/2440687#M97288</link>
      <description>&lt;P&gt;I hope someone can help me with my chalenge:&lt;/P&gt;
&lt;P&gt;I am getting a dataset through a SQL query. That is not the challenging part.&amp;nbsp; But for every record in that dataset, I want to do more SQL queries.&lt;/P&gt;
&lt;P&gt;The first dataset contains variables where the new data need to be reed from.&lt;/P&gt;
&lt;P&gt;Al the new datasets I want to land in new datasets. For every record in the first dataset I want to put records in the same tabel as the other records.&lt;/P&gt;
&lt;P&gt;for example:&lt;/P&gt;
&lt;DIV&gt;&lt;LI-CODE lang="markup"&gt;Variables:
SQL
  Select Naam
  , Var1
  , Var2
  , Var3
  From Person
;

For each Naam in Variables
Table1:
SQL
Select Naam
,    Field1
    , Field2
    From Var1
;
Table2:
SQL
Select Naam
,    Field1
    , Field2
    From Var2
;
Table3:
SQL
Select Naam
,    Field1
    , Field2
    From Var3
;
Next Naam&lt;/LI-CODE&gt;&lt;/DIV&gt;
&lt;P&gt;I tried 'Peek' and 'subfield' but both did not gave me the answer.&lt;/P&gt;
&lt;P&gt;Probably I am doing it wrong. Is there anybody who already has experience with a simulair challange/problem?&lt;/P&gt;
&lt;P&gt;Thank for your help/reply.&lt;/P&gt;
&lt;P&gt;Sasja&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 13:31:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Loop-through-a-data-set/m-p/2440687#M97288</guid>
      <dc:creator>Sasja</dc:creator>
      <dc:date>2024-04-12T13:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through a data set</title>
      <link>https://community.qlik.com/t5/App-Development/Loop-through-a-data-set/m-p/2440740#M97297</link>
      <description>&lt;P&gt;The loop for multiple sql isn't quite clear for me but you may use something like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;for i = 0 to noofrows('Variables') - 1
   vNaam = peek('Naam', $(i), 'Variables');
   vVar1 = peek('Var1', $(i), 'Variables');
   vVar2 = peek('Var2', $(i), 'Variables');
   vVar3 = peek('Var3', $(i), 'Variables');
next&lt;/LI-CODE&gt;
&lt;P&gt;which would assign the field-values in each iteration to the variables - which you could apply within the sql-statements like: $(vVar1) or '$(vVar1)' depending if the content is a number or a string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 15:24:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Loop-through-a-data-set/m-p/2440740#M97297</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2024-04-12T15:24:18Z</dc:date>
    </item>
  </channel>
</rss>

