<?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: calling sub-routine with table creation breaks peek() in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/calling-sub-routine-with-table-creation-breaks-peek/m-p/649946#M476285</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You probably need a &lt;STRONG&gt;Concatenate, &lt;/STRONG&gt;like:&lt;/P&gt;&lt;P&gt;if '$(createTableYN)' = 'Y' then&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt; Concatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; subTable:&lt;/P&gt;&lt;P&gt;&amp;nbsp; load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; '$(inputMonth)' as subMonth&lt;/P&gt;&lt;P&gt;&amp;nbsp; autogenerate 1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jun 2014 10:36:05 GMT</pubDate>
    <dc:creator>tresB</dc:creator>
    <dc:date>2014-06-10T10:36:05Z</dc:date>
    <item>
      <title>calling sub-routine with table creation breaks peek()</title>
      <link>https://community.qlik.com/t5/QlikView/calling-sub-routine-with-table-creation-breaks-peek/m-p/649942#M476281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Im developing an application where i first produce a list of field values that a later on send to a sub-routine that uses the field value when creating a table.&lt;/P&gt;&lt;P&gt;It works as expected if i do not create a table inside my sub-routine but the peek('fieldname',$(i)) I use to get the field value from the first table to send to the sub-routine only works for i = 0 (or the first peek() used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestion that the issue could be?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached a small qv app that shows the issue, setting the last parameter in the sub-routine call to 'Y' breaks the peek(). Setting it to 'N' everything is working as expected (as no table is created inside the sub-routine).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;sub ffs(inputMonth,createTableYN)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; trace inside sub-routine month is '$(inputMonth)';&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if '$(createTableYN)' = 'Y' then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; subTable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; load&lt;/P&gt;
&lt;P&gt;&amp;nbsp; '$(inputMonth)' as subMonth&lt;/P&gt;
&lt;P&gt;&amp;nbsp; autogenerate 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; else&lt;/P&gt;
&lt;P&gt;&amp;nbsp; endif;&lt;/P&gt;
&lt;P&gt;end sub;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;months:&lt;/P&gt;
&lt;P&gt;load&lt;/P&gt;
&lt;P&gt;&amp;nbsp; month(addmonths(yearstart(today()),recNo())) as month&lt;/P&gt;
&lt;P&gt;autogenerate 12&lt;/P&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;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// by creating a table in the sub-routine call (last parameter = 'Y') the peek will cease to function properly as only first value is fetched&lt;/P&gt;
&lt;P&gt;for i = 0 to fieldvalueCount('month')-1&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Let vMonth = peek('month',$(i));&lt;/P&gt;
&lt;P&gt;&amp;nbsp; call ffs('$(vMonth)','N');&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;next;&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;App has been tested in 11.2 SR4 and 11.2 SR6 with the same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Br Johan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 10:15:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/calling-sub-routine-with-table-creation-breaks-peek/m-p/649942#M476281</guid>
      <dc:creator>blaise</dc:creator>
      <dc:date>2014-06-10T10:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: calling sub-routine with table creation breaks peek()</title>
      <link>https://community.qlik.com/t5/QlikView/calling-sub-routine-with-table-creation-breaks-peek/m-p/649943#M476282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Peek() function always fetches data from the latest created table - unless you use the third parameter. So, the solution is probably to use the third parameter:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Let vMonth = peek('month',$(i),'months');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 10:25:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/calling-sub-routine-with-table-creation-breaks-peek/m-p/649943#M476282</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2014-06-10T10:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: calling sub-routine with table creation breaks peek()</title>
      <link>https://community.qlik.com/t5/QlikView/calling-sub-routine-with-table-creation-breaks-peek/m-p/649944#M476283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I guess QlikView Script Engine isn't really re-entrant.&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/cry.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 10:26:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/calling-sub-routine-with-table-creation-breaks-peek/m-p/649944#M476283</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2014-06-10T10:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: calling sub-routine with table creation breaks peek()</title>
      <link>https://community.qlik.com/t5/QlikView/calling-sub-routine-with-table-creation-breaks-peek/m-p/649945#M476284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ouch, what a newbie mistake!&lt;/P&gt;&lt;P&gt;Thanks Henric, and sorry for taking up your time with such simple questions &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 10:35:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/calling-sub-routine-with-table-creation-breaks-peek/m-p/649945#M476284</guid>
      <dc:creator>blaise</dc:creator>
      <dc:date>2014-06-10T10:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: calling sub-routine with table creation breaks peek()</title>
      <link>https://community.qlik.com/t5/QlikView/calling-sub-routine-with-table-creation-breaks-peek/m-p/649946#M476285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You probably need a &lt;STRONG&gt;Concatenate, &lt;/STRONG&gt;like:&lt;/P&gt;&lt;P&gt;if '$(createTableYN)' = 'Y' then&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt; Concatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; subTable:&lt;/P&gt;&lt;P&gt;&amp;nbsp; load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; '$(inputMonth)' as subMonth&lt;/P&gt;&lt;P&gt;&amp;nbsp; autogenerate 1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 10:36:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/calling-sub-routine-with-table-creation-breaks-peek/m-p/649946#M476285</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2014-06-10T10:36:05Z</dc:date>
    </item>
  </channel>
</rss>

