<?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: Storing multiple values in a variable from For loop in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507243#M436378</link>
    <description>&lt;P&gt;You are right Concat() is much much better instead of a FOR loop with Peek().&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Nov 2018 13:30:47 GMT</pubDate>
    <dc:creator>petter</dc:creator>
    <dc:date>2018-11-15T13:30:47Z</dc:date>
    <item>
      <title>Storing multiple values in a variable from For loop</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507212#M436368</link>
      <description>&lt;P&gt;I have one for loop for values i = A1 to A100 . I am using peek function and storing 1 value at a time in a variable V1 = A1&lt;/P&gt;&lt;P&gt;and then passing this variable into another table to retrieve certain values.&lt;/P&gt;&lt;P&gt;Instead of 1 value at a time of i need to pass 'i' values&amp;nbsp;V1 = A1,A2,A3,A4..&amp;nbsp;&amp;nbsp;..etc in a variable V1 comma separated format how can i achieve that in this case?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 05:14:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507212#M436368</guid>
      <dc:creator>rsdhavle</dc:creator>
      <dc:date>2024-11-16T05:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: Storing multiple values in a variable from For loop</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507220#M436369</link>
      <description>something like:&lt;BR /&gt;for i = 1 to 100&lt;BR /&gt;&lt;BR /&gt;next i</description>
      <pubDate>Thu, 15 Nov 2018 13:18:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507220#M436369</guid>
      <dc:creator>m_woolf</dc:creator>
      <dc:date>2018-11-15T13:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Storing multiple values in a variable from For loop</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507221#M436370</link>
      <description>&lt;P&gt;this is the loop i already have but i am storing currently 1 value from this loop in variable like v1 = 1 instead of that can i save multiple values in comma separated format like v1 = 1,2,3&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 13:19:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507221#M436370</guid>
      <dc:creator>rsdhavle</dc:creator>
      <dc:date>2018-11-15T13:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: Storing multiple values in a variable from For loop</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507228#M436371</link>
      <description>&lt;P&gt;In your loop you can do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;v1 = v1 &amp;amp; ',' &amp;amp; v2;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;v1 = v1 &amp;amp; ',' &amp;amp; Peek('aField', i+1 , 'aTable');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After the loop you will have the variable v1 containing all the v2 values in one single string with comma as separator between the values.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 13:26:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507228#M436371</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-11-15T13:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: Storing multiple values in a variable from For loop</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507235#M436372</link>
      <description>&lt;P&gt;Wont a Concat() function be handy with your requirement?&lt;BR /&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/StringAggregationFunctions/concat.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/StringAggregationFunctions/concat.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;table00:&lt;BR /&gt;Load&lt;BR /&gt;Concat(Values,',') as Values;&lt;BR /&gt;Load * Inline [&lt;BR /&gt;Values&lt;BR /&gt;A1&lt;BR /&gt;A2&lt;BR /&gt;A3&lt;BR /&gt;A4&lt;BR /&gt;A5&lt;BR /&gt;A6&lt;BR /&gt;A7&lt;BR /&gt;A8&lt;BR /&gt;A9&lt;BR /&gt;A10&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;LET v1 = Peek('Values',-1,'table00');&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 13:35:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507235#M436372</guid>
      <dc:creator>jpenuliar</dc:creator>
      <dc:date>2018-11-15T13:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Storing multiple values in a variable from For loop</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507243#M436378</link>
      <description>&lt;P&gt;You are right Concat() is much much better instead of a FOR loop with Peek().&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 13:30:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507243#M436378</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-11-15T13:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Storing multiple values in a variable from For loop</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507254#M436379</link>
      <description>Can you give one sample please..how can i judge range for example i have 1 to 10000 values for 'i' with concat how can i define range?</description>
      <pubDate>Thu, 15 Nov 2018 13:33:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507254#M436379</guid>
      <dc:creator>rsdhavle</dc:creator>
      <dc:date>2018-11-15T13:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Storing multiple values in a variable from For loop</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507255#M436380</link>
      <description>&lt;P&gt;A Concat() version of the code would look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TEMP:&lt;BR /&gt;LOAD Concat(aField, ',' ,aField) AS FieldString RESIDENT aTable;&lt;/P&gt;&lt;P&gt;v1 = Peek('FieldString',0,'TEMP');&lt;/P&gt;&lt;P&gt;DROP TABLE TEMP;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 13:33:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507255#M436380</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-11-15T13:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Storing multiple values in a variable from For loop</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507277#M436381</link>
      <description>&lt;P&gt;Thanks i am checking this however where will i define range in this? for example out of 1000 values i have to load set of 100 first then 101-200 and so on..&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 13:44:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507277#M436381</guid>
      <dc:creator>rsdhavle</dc:creator>
      <dc:date>2018-11-15T13:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Storing multiple values in a variable from For loop</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507411#M436384</link>
      <description>&lt;P&gt;You can use the WHERE clause checking with the RecNo() function to get a range:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" size="3"&gt;LOAD&lt;BR /&gt;&amp;nbsp; Concat(aField, ',' ,aField) AS FieldString&lt;BR /&gt;RESIDENT&lt;BR /&gt;&amp;nbsp; aTable&lt;BR /&gt;WHERE&lt;BR /&gt;&amp;nbsp; RecNo()&amp;gt;=1 AND RecNo()&amp;lt;=100;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Repeating this with a FOR is not efficient so I would rather use the GROUP BY to create all the concatenated strings in one load:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" size="3"&gt;LOAD&lt;BR /&gt;&amp;nbsp; RangeNo,&lt;BR /&gt;&amp;nbsp; Concat(aField, ',' ,aField) AS FieldString&lt;BR /&gt;GROUP BY&lt;BR /&gt;&amp;nbsp; RangeNo;&lt;BR /&gt;LOAD&lt;BR /&gt;&amp;nbsp; Ceil(RecNo()/100) AS RangeNo,&lt;BR /&gt;&amp;nbsp; aField&lt;BR /&gt;RESIDENT&lt;BR /&gt;&amp;nbsp; aTable;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The resulting table will consists of rows of 100 concatenated values on each row.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 15:41:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507411#M436384</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-11-15T15:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Storing multiple values in a variable from For loop</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507726#M436415</link>
      <description>&lt;P&gt;If you find any or all of the replies or suggestions helpful please mark them with a like as it seems to be the only way you credit anyone on this community site except from tagging with answered. Just writing "thanks" or anything verbally doesn't give people credit technically although they of course appreciate that too... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 06:42:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1507726#M436415</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-11-16T06:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Storing multiple values in a variable from For loop</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1508102#M436427</link>
      <description>&lt;P&gt;I have one question with this .i understand for loop will impact performance but this query gives me 100 values in multiple rows however when i pass this accounts values in the variable i will have to pass one value(consisting of 100 ) accounts at a time. So i will need loop right passing 1 row at a time?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 13:42:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1508102#M436427</guid>
      <dc:creator>rsdhavle</dc:creator>
      <dc:date>2018-11-16T13:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Storing multiple values in a variable from For loop</title>
      <link>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1508106#M436428</link>
      <description>&lt;P&gt;Correct - so you will not avoid the for loop entirely but you speed up the generation of the variables enormously.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 13:44:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Storing-multiple-values-in-a-variable-from-For-loop/m-p/1508106#M436428</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-11-16T13:44:13Z</dc:date>
    </item>
  </channel>
</rss>

