<?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: Loop though table in script to make calculation in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1579551#M597537</link>
    <description>&lt;P&gt;Finally, I have had the opportunity to test your solutions. They do the job excellently, both of them. Thank you so much for your help! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Anna&lt;/P&gt;</description>
    <pubDate>Mon, 13 May 2019 14:26:27 GMT</pubDate>
    <dc:creator>annanirvin</dc:creator>
    <dc:date>2019-05-13T14:26:27Z</dc:date>
    <item>
      <title>Loop though table in script to make calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1576666#M597530</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;Let's say we have a table like Table below and&amp;nbsp;a variable with the value 5. Is it possible to loop through the table to reduce the value of Qty by one per row so that Qty for ID 1 = 22, ID 2 = 33, ID 3 = 55, ID 4 = 21 and ID 5 = 33? I want to do the calculation in the script.&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ID, Qty&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 1, 23&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 2, 34&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 3, 56&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 4, 22&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 5, 34&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 6, 21&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;</description>
      <pubDate>Sun, 05 May 2019 17:03:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1576666#M597530</guid>
      <dc:creator>annanirvin</dc:creator>
      <dc:date>2019-05-05T17:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Loop though table in script to make calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1576671#M597531</link>
      <description>&lt;P&gt;The variable = 5 does it limit which row you want to adjust? If so, do like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;LET vVariable= 5;

Table:
LOAD 
  ID,
  //Qty as [Original Qty],
  if(ID&amp;gt;=$(vVariable), Qty, Qty-1) as Qty 
INLINE [
   ID, Qty
   1, 23
   2, 34
   3, 56
   4, 22
   5, 34
   6, 21
];&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 07:24:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1576671#M597531</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2019-05-06T07:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Loop though table in script to make calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1576678#M597532</link>
      <description>&lt;P&gt;Hi Annanirvin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please expand your requirement with the example dataset of minimum 15values n please share both the input table &amp;amp; output table screens.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 05 May 2019 21:19:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1576678#M597532</guid>
      <dc:creator>aravind_dussani</dc:creator>
      <dc:date>2019-05-05T21:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Loop though table in script to make calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1576759#M597533</link>
      <description>&lt;P&gt;Hi! there is no need for a loop. I understood that your variable controls the number of the (first) rows which Value must be sustracted by 1 (so I won't use ID). The following code worked for me:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LET RowsToReduce = 5;

OriginalTable:
LOAD * INLINE [
    ID, Value
    1, 1
    2, 2
    3, 3
    4, 4
    5, 5
    6, 6
    7, 7
    8, 8
    9, 9
    10, 10
];

ModififiedTable:
NoConcatenate LOAD
	ID,
	if(RecNo() &amp;lt;= $(RowsToReduce), Value-1, Value) as Value
Resident OriginalTable;

DROP Table OriginalTable;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bests,&lt;/P&gt;&lt;P&gt;Jaime.&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 07:20:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1576759#M597533</guid>
      <dc:creator>jaibau1993</dc:creator>
      <dc:date>2019-05-06T07:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Loop though table in script to make calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1576767#M597534</link>
      <description>&lt;P&gt;Mine and&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/4168"&gt;@jaibau1993&lt;/a&gt;&amp;nbsp; suggested solutions will give you a similar output.&amp;nbsp; The big difference is if you want to do the manipulation IF(...) when you load the data from the source or if you want to adjust it after it is loaded.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If we've understood your problem correctly, please mark one (or both) as an accepted solution, if not then please elaborate your problem and we could try to adjust our suggestion to your needs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Vegar&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 07:29:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1576767#M597534</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2019-05-06T07:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: Loop though table in script to make calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1577066#M597535</link>
      <description>Thanks for your suggestions and forgive my late reply, I'm busy in meetings all day. I'll try the suggestions as soon as I can and feed back to you then.&lt;BR /&gt;&lt;BR /&gt;Kind regards&lt;BR /&gt;Anna&lt;BR /&gt;</description>
      <pubDate>Mon, 06 May 2019 16:37:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1577066#M597535</guid>
      <dc:creator>annanirvin</dc:creator>
      <dc:date>2019-05-06T16:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Loop though table in script to make calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1579546#M597536</link>
      <description />
      <pubDate>Mon, 13 May 2019 14:24:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1579546#M597536</guid>
      <dc:creator>annanirvin</dc:creator>
      <dc:date>2019-05-13T14:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Loop though table in script to make calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1579551#M597537</link>
      <description>&lt;P&gt;Finally, I have had the opportunity to test your solutions. They do the job excellently, both of them. Thank you so much for your help! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Anna&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 14:26:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-though-table-in-script-to-make-calculation/m-p/1579551#M597537</guid>
      <dc:creator>annanirvin</dc:creator>
      <dc:date>2019-05-13T14:26:27Z</dc:date>
    </item>
  </channel>
</rss>

