<?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: Let scope in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Let-scope/m-p/1178571#M382300</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your example and for your detailed explanation &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Aug 2016 19:20:56 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-08-01T19:20:56Z</dc:date>
    <item>
      <title>Let scope</title>
      <link>https://community.qlik.com/t5/QlikView/Let-scope/m-p/1178566#M382295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a loop in my script, something like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For i = 0 TO 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET expr = i * 2;&lt;/P&gt;&lt;P&gt;NEXT i&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know whether expr variable created within loop is available outside loop for, for example, could I do something like below?&lt;/P&gt;&lt;P&gt;or I need to declare variable expr before loop for using SET sentence?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;For i = 0 TO 10&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET expr = i * 2;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;NEXT i&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;LET another_expr = expr;&amp;nbsp; // What is the value for expr here? 20?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jul 2016 15:51:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Let-scope/m-p/1178566#M382295</guid>
      <dc:creator />
      <dc:date>2016-07-29T15:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Let scope</title>
      <link>https://community.qlik.com/t5/QlikView/Let-scope/m-p/1178567#M382296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Might be from 0 to 9 The values are not correct. That's why the loop working on 10th Value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10 * 2 = 20&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jul 2016 16:01:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Let-scope/m-p/1178567#M382296</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2016-07-29T16:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: Let scope</title>
      <link>https://community.qlik.com/t5/QlikView/Let-scope/m-p/1178568#M382297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tony TP,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;variable expr is not private to the for loop.&lt;/P&gt;&lt;P&gt;That's why, you can perform transferring value of expr to another_expr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which is 20 at the end of For Next.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its interesting to run the loop in debug to follow the iterations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;jp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jul 2016 16:07:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Let-scope/m-p/1178568#M382297</guid>
      <dc:creator>jpenuliar</dc:creator>
      <dc:date>2016-07-29T16:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: Let scope</title>
      <link>https://community.qlik.com/t5/QlikView/Let-scope/m-p/1178569#M382298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Qlikview variables are always global scope.&lt;/P&gt;&lt;P&gt;in your case, last value for &lt;SPAN style="color: #000000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;expr = 10 * 2 = 20&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jul 2016 16:33:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Let-scope/m-p/1178569#M382298</guid>
      <dc:creator>Clever_Anjos</dc:creator>
      <dc:date>2016-07-29T16:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Let scope</title>
      <link>https://community.qlik.com/t5/QlikView/Let-scope/m-p/1178570#M382299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this, I added some trace to your "for loop"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For i = 0 TO 10&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET expr = i * 2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; trace i=$(i) expr=$(expr);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;NEXT i&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LET another_expr = expr;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;trace another_expr=$(another_expr);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and you get this result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;i=0 expr=0&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;i=1 expr=2&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;i=2 expr=4&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;i=3 expr=6&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;i=4 expr=8&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;i=5 expr=10&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;i=6 expr=12&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;i=7 expr=14&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;i=8 expr=16&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;i=9 expr=18&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;i=10 expr=20&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;another_expr=20&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I would like to know whether expr variable created within loop is available outside loop for, for example, could I do something like below?&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yes&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;or I need to declare variable expr before loop for using SET sentence?&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; no&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;LET another_expr = expr;&amp;nbsp; // What is the value for expr here? 20?&lt;/SPAN&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jul 2016 20:34:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Let-scope/m-p/1178570#M382299</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2016-07-29T20:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Let scope</title>
      <link>https://community.qlik.com/t5/QlikView/Let-scope/m-p/1178571#M382300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your example and for your detailed explanation &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2016 19:20:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Let-scope/m-p/1178571#M382300</guid>
      <dc:creator />
      <dc:date>2016-08-01T19:20:56Z</dc:date>
    </item>
  </channel>
</rss>

