<?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 Nested Loop in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Nested-Loop/m-p/2034831#M85286</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;Can anyone tell me why the below is not working:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For vRow = 1 to NoOfRows('Events_Data')&lt;/P&gt;
&lt;P&gt;Let vID = Peek('ID',vRow-1,'Events_Data');&lt;/P&gt;
&lt;P&gt;For vRow_Att = 1 to NoOfRows('Attendees_Data')&lt;/P&gt;
&lt;P&gt;Let vID_Att = Peek('ID_Att',vRow-1,'Attendees_Data');&lt;/P&gt;
&lt;P&gt;LIB CONNECT TO 'Connection_Name';&lt;/P&gt;
&lt;P&gt;RestConnectorMasterTable:&lt;BR /&gt;SQL SELECT&lt;BR /&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;FROM JSON (wrap on) "root" PK "__KEY_root"&lt;BR /&gt;WITH CONNECTION(&lt;BR /&gt;URL "https://***-***.***.com/**/***/$(vID)/***/***",&lt;BR /&gt;QUERY "filter" "attendee.id eq '$(vID_Att)'",&lt;BR /&gt;HTTPHEADER "Authorization" "Bearer $(vToken)"&lt;BR /&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;Next&lt;/P&gt;
&lt;P&gt;Next;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to do a nested loop, because I have different event IDs and different attendee IDs and my idea is to go through each event ID from my Events_ID table and get data for each attendee ID from my Attendee_ID table. If I run the above script it just never ends... While if instead of the&amp;nbsp;vID_Att variable I type a specific attendee ID it works. So it seems I just need to correctly go through all attendee IDs.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Please help as it is kind of urgent to be completed. Any ideas will be appreciated.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Feb 2023 09:11:56 GMT</pubDate>
    <dc:creator>SilviyaK</dc:creator>
    <dc:date>2023-02-07T09:11:56Z</dc:date>
    <item>
      <title>Nested Loop</title>
      <link>https://community.qlik.com/t5/App-Development/Nested-Loop/m-p/2034831#M85286</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;Can anyone tell me why the below is not working:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For vRow = 1 to NoOfRows('Events_Data')&lt;/P&gt;
&lt;P&gt;Let vID = Peek('ID',vRow-1,'Events_Data');&lt;/P&gt;
&lt;P&gt;For vRow_Att = 1 to NoOfRows('Attendees_Data')&lt;/P&gt;
&lt;P&gt;Let vID_Att = Peek('ID_Att',vRow-1,'Attendees_Data');&lt;/P&gt;
&lt;P&gt;LIB CONNECT TO 'Connection_Name';&lt;/P&gt;
&lt;P&gt;RestConnectorMasterTable:&lt;BR /&gt;SQL SELECT&lt;BR /&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;FROM JSON (wrap on) "root" PK "__KEY_root"&lt;BR /&gt;WITH CONNECTION(&lt;BR /&gt;URL "https://***-***.***.com/**/***/$(vID)/***/***",&lt;BR /&gt;QUERY "filter" "attendee.id eq '$(vID_Att)'",&lt;BR /&gt;HTTPHEADER "Authorization" "Bearer $(vToken)"&lt;BR /&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;Next&lt;/P&gt;
&lt;P&gt;Next;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to do a nested loop, because I have different event IDs and different attendee IDs and my idea is to go through each event ID from my Events_ID table and get data for each attendee ID from my Attendee_ID table. If I run the above script it just never ends... While if instead of the&amp;nbsp;vID_Att variable I type a specific attendee ID it works. So it seems I just need to correctly go through all attendee IDs.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Please help as it is kind of urgent to be completed. Any ideas will be appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 09:11:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Nested-Loop/m-p/2034831#M85286</guid>
      <dc:creator>SilviyaK</dc:creator>
      <dc:date>2023-02-07T09:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Loop</title>
      <link>https://community.qlik.com/t5/App-Development/Nested-Loop/m-p/2034917#M85290</link>
      <description>&lt;P&gt;The second loop iterates with the same variable as the first loop which is probably not intended. Beside this it's quite unclear if both loops with the variable-assigning per peek-values would work like expected - because for such a use-case they would need to be appropriate synchronized.&lt;/P&gt;
&lt;P&gt;Simpler as this seems for me to merge both information into a single table which is then read within a single loop.&lt;/P&gt;
&lt;P&gt;As first step I suggest you reduced the tables to maybe a dozens records, commenting the load-part and viewing the loop-results within TRACE statements or just writing them within another table, like:&lt;/P&gt;
&lt;P&gt;load *, rowno() as RowNo;&lt;BR /&gt;load $(&lt;SPAN&gt;vRow) as vRow, $(vRow_Att) as&amp;nbsp;vRow_Att, '$(vID)' as vID,&amp;nbsp;'$(vID_Att)' as vID_Att&lt;BR /&gt;autogenerate 1;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If the results are really suitable you could increase the data-set and checking it again and after that you may try your real load.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 12:13:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Nested-Loop/m-p/2034917#M85290</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-02-07T12:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Nested Loop</title>
      <link>https://community.qlik.com/t5/App-Development/Nested-Loop/m-p/2035260#M85315</link>
      <description>&lt;P&gt;why not consolidate Events and Attendees in a single table using&amp;nbsp; a Join ?&lt;/P&gt;
&lt;P&gt;and then do a single loop instead of nested loops&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 03:42:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Nested-Loop/m-p/2035260#M85315</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2023-02-08T03:42:32Z</dc:date>
    </item>
  </channel>
</rss>

