<?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: Peek function in a do while loop in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1595091#M595819</link>
    <description>&lt;P&gt;What is the expected output based on the sample provided here?&lt;/P&gt;</description>
    <pubDate>Mon, 24 Jun 2019 12:27:55 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2019-06-24T12:27:55Z</dc:date>
    <item>
      <title>Peek function in a do while loop</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1594873#M595816</link>
      <description>&lt;P&gt;Hi All!&lt;/P&gt;&lt;P&gt;I used several times peek function but in this case i am not able to let it works!&lt;/P&gt;&lt;P&gt;Here is my code,I'm trying to loop a calculation until all values in&amp;nbsp;New_TEMPO_BRAND_SITE_3 are positive.&lt;/P&gt;&lt;P&gt;All seems to work except the assignment of v_iteration, always null &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance for any suggestion!!&lt;/P&gt;&lt;P&gt;INTERVALLO:&lt;BR /&gt;LOAD DISTINCT&lt;BR /&gt;MAX(KEY_TABLE) AS MASSIMO,&lt;BR /&gt;MIN(KEY_TABLE) AS MINIMO&lt;BR /&gt;Resident NEW_TEMPO_RICALCOLO&lt;BR /&gt;WHERE FLG_MONTH_BRAND='1';&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;lET v_minimo = Peek('MINIMO',0,'INTERVALLO');&lt;BR /&gt;lET v_massimo = Peek('MASSIMO',0,'INTERVALLO');&lt;BR /&gt;&lt;BR /&gt;for s=v_minimo to v_massimo;&lt;/P&gt;&lt;P&gt;Set a=0;&lt;BR /&gt;set e_flag=0;&lt;/P&gt;&lt;P&gt;Do while e_flag=0;&lt;/P&gt;&lt;P&gt;set e_flag=1;&lt;/P&gt;&lt;P&gt;TEMPO_WHILE_BRAND_TMP_$(s):&lt;/P&gt;&lt;P&gt;LOAD distinct&lt;BR /&gt;KEY_TEMPO,&lt;BR /&gt;YEAR_MONTH_NATION,&lt;BR /&gt;TODAY_CHECK_BRAND,&lt;BR /&gt;TIME_BRAND_SITE_VISITS,DATE_2,&lt;BR /&gt;GG_BRAND,&lt;BR /&gt;KEY_TABLE,&lt;BR /&gt;Consensus_BRAND_SITE+(Consensus_BRAND_SITE*$(a)) as NEW_Consensus_BRAND_SITE,&lt;/P&gt;&lt;P&gt;IF(TODAY_CHECK_BRAND&amp;lt;2,BRAND_SITE_VISITS_ACT/(Consensus_BRAND_SITE*(1+$(a)))) AS BRAND_SITE_LESS_2&lt;BR /&gt;Resident NEW_TEMPO_RICALCOLO&lt;/P&gt;&lt;P&gt;where KEY_TABLE='$(s)' ;&lt;/P&gt;&lt;P&gt;LEFT JOIN ('TEMPO_WHILE_BRAND_TMP_$(s)')&lt;/P&gt;&lt;P&gt;LOAD DISTINCT&lt;BR /&gt;YEAR_MONTH_NATION,&lt;BR /&gt;SUM(BRAND_SITE_LESS_2) AS SOMMA_BRAND_ACT,&lt;BR /&gt;SUM(TIME_BRAND_SITE_VISITS) AS SOMMA_BRAND_OLD&lt;/P&gt;&lt;P&gt;Resident TEMPO_WHILE_BRAND_TMP_$(s)&lt;BR /&gt;WHERE TODAY_CHECK_BRAND&amp;lt;2&lt;BR /&gt;GROUP BY YEAR_MONTH_NATION;&lt;/P&gt;&lt;P&gt;LEFT JOIN ('TEMPO_WHILE_BRAND_TMP_$(s)')&lt;BR /&gt;LOAD DISTINCT&lt;BR /&gt;KEY_TEMPO,&lt;BR /&gt;NEW_Consensus_BRAND_SITE,&lt;BR /&gt;KEY_TABLE,&lt;BR /&gt;IF(TODAY_CHECK_BRAND&amp;lt;2,BRAND_SITE_LESS_2,&lt;BR /&gt;TIME_BRAND_SITE_VISITS-(SOMMA_BRAND_ACT-SOMMA_BRAND_OLD)/(DAY(MonthEnd(Date(Date#(DATE_2,'YYYYMMDD'),'MM/DD/YYYY')))-GG_BRAND)) AS New_TEMPO_BRAND_SITE_2,&lt;BR /&gt;if(replace((IF(TODAY_CHECK_BRAND&amp;lt;2,BRAND_SITE_LESS_2,&lt;BR /&gt;TIME_BRAND_SITE_VISITS-(SOMMA_BRAND_ACT-SOMMA_BRAND_OLD)/(DAY(MonthEnd(Date(Date#(DATE_2,'YYYYMMDD'),'MM/DD/YYYY')))-GG_BRAND))),',','.')&amp;lt;0,1,0) as check,&lt;BR /&gt;replace((IF(TODAY_CHECK_BRAND&amp;lt;2,BRAND_SITE_LESS_2,&lt;BR /&gt;TIME_BRAND_SITE_VISITS-(SOMMA_BRAND_ACT-SOMMA_BRAND_OLD)/(DAY(MonthEnd(Date(Date#(DATE_2,'YYYYMMDD'),'MM/DD/YYYY')))-GG_BRAND))),',','.') AS New_TEMPO_BRAND_SITE_3&lt;BR /&gt;RESIDENT TEMPO_WHILE_BRAND_TMP_$(s);&lt;/P&gt;&lt;P&gt;let v_table= 'TEMPO_WHILE_BRAND_TMP_$(s)';&lt;/P&gt;&lt;P&gt;Let vNoOfRows = NoOfRows('$(v_table)');&lt;/P&gt;&lt;P&gt;for i=0 to vNoOfRows;&lt;BR /&gt;let v_name= chr(39)&amp;amp;'TEMPO_WHILE_BRAND_TMP_'&amp;amp;$(s)&amp;amp;chr(39);&lt;BR /&gt;Let v_iteration = Peek('New_TEMPO_BRAND_SITE_3', $(i),$(v_name));&lt;/P&gt;&lt;P&gt;if $(v_iteration)&amp;lt;0 then&lt;BR /&gt;&lt;BR /&gt;set e_flag = '0';&lt;/P&gt;&lt;P&gt;end if&lt;BR /&gt;next i;&lt;BR /&gt;Let a= $(a) + 0.1;&lt;BR /&gt;Loop;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 20:36:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1594873#M595816</guid>
      <dc:creator>eva_bornaccini</dc:creator>
      <dc:date>2024-11-16T20:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Peek function in a do while loop</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1595070#M595817</link>
      <description>&lt;P&gt;Would you be able to share a sample to test this out?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2019 11:52:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1595070#M595817</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-06-24T11:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Peek function in a do while loop</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1595087#M595818</link>
      <description>&lt;P&gt;Hi Sunny, here data and QVW. I tryed to upload data through load inline but maybe (same problem as mine) something doesn't work in resident inside for and while loop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2019 12:20:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1595087#M595818</guid>
      <dc:creator>eva_bornaccini</dc:creator>
      <dc:date>2019-06-24T12:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: Peek function in a do while loop</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1595091#M595819</link>
      <description>&lt;P&gt;What is the expected output based on the sample provided here?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2019 12:27:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1595091#M595819</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-06-24T12:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Peek function in a do while loop</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1595092#M595820</link>
      <description>&lt;P&gt;All values in&amp;nbsp;New_TEMPO_BRAND_SITE_3 must be positive. And to let it happends&amp;nbsp;NEW_Consensus_BRAND_SITE should increase thanks to while loop.&lt;/P&gt;&lt;P&gt;But peek function doesn't work and while loop exit atthe first round&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2019 12:31:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1595092#M595820</guid>
      <dc:creator>eva_bornaccini</dc:creator>
      <dc:date>2019-06-24T12:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Peek function in a do while loop</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1595107#M595821</link>
      <description>&lt;P&gt;I don't think I follow along your script.... that is why I asked you to provide me the output so that I can understand the script or create one which might work based on the output needed. When I say the expected output, I mean the exact numbers you are hoping to see based on the sample provided.....&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2019 12:49:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1595107#M595821</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-06-24T12:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Peek function in a do while loop</title>
      <link>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1595150#M595831</link>
      <description>&lt;P&gt;Here u are&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2019 13:35:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Peek-function-in-a-do-while-loop/m-p/1595150#M595831</guid>
      <dc:creator>eva_bornaccini</dc:creator>
      <dc:date>2019-06-24T13:35:31Z</dc:date>
    </item>
  </channel>
</rss>

