<?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: [resolved] while loop with several conditions in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-while-loop-with-several-conditions/m-p/2292177#M65284</link>
    <description>hi Felix&lt;BR /&gt;how do you calculate this?&lt;BR /&gt;it seems that you are checking every row&lt;BR /&gt;is that correct?&lt;BR /&gt;it so, you will be relying on the last row to have the value that you expect.&lt;BR /&gt;is that correct?</description>
    <pubDate>Fri, 24 Oct 2014 21:51:15 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-10-24T21:51:15Z</dc:date>
    <item>
      <title>[resolved] while loop with several conditions</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-while-loop-with-several-conditions/m-p/2292176#M65283</link>
      <description>Hi there, 
&lt;BR /&gt;I have the following issue with a while loop and could not find an solution here in the forums: 
&lt;BR /&gt;The loop should run 25 times to generate some data which is then later written to a MS SQL database. So far the loop works as expected. 
&lt;BR /&gt; 
&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/178555/blob_20141024-1635.png" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBMF.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/131881i116F429AAC4039BA/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBMF.png" alt="0683p000009MBMF.png" /&gt;&lt;/span&gt; &lt;/A&gt; 
&lt;BR /&gt;Now I should be able to add an additional condition which causes the loop to run only until this condition is met or 25 runs have been accomplished. The value of this condition (OK/NOK) is generated in the loop itself, based on the data generated. 
&lt;BR /&gt;I tried to work with a context variable but am unable to use it in the loop. With the tJavaRow component the value for this condition is added to the context variable. 
&lt;BR /&gt; 
&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/178555/blob_20141024-1651.png" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBKA.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/131327i7BCBCFFDA05E6A50/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBKA.png" alt="0683p000009MBKA.png" /&gt;&lt;/span&gt; &lt;/A&gt; 
&lt;BR /&gt; 
&lt;BR /&gt;Could anyone please give me a hint of how to do this? 
&lt;BR /&gt;Your help is very much appreciated. 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;Felix</description>
      <pubDate>Fri, 24 Oct 2014 15:54:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-while-loop-with-several-conditions/m-p/2292176#M65283</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-24T15:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] while loop with several conditions</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-while-loop-with-several-conditions/m-p/2292177#M65284</link>
      <description>hi Felix&lt;BR /&gt;how do you calculate this?&lt;BR /&gt;it seems that you are checking every row&lt;BR /&gt;is that correct?&lt;BR /&gt;it so, you will be relying on the last row to have the value that you expect.&lt;BR /&gt;is that correct?</description>
      <pubDate>Fri, 24 Oct 2014 21:51:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-while-loop-with-several-conditions/m-p/2292177#M65284</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-24T21:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] while loop with several conditions</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-while-loop-with-several-conditions/m-p/2292178#M65285</link>
      <description>Hi Nicolas 
&lt;BR /&gt;Thank your for your reply. 
&lt;BR /&gt; 
&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;it seems that you are checking every row&lt;BR /&gt;is that correct?&lt;BR /&gt;it so, you will be relying on the last row to have the value that you expect.&lt;BR /&gt;is that correct?&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Not exactly, in fact the first row determines all the relevant Data (=basic data). Each row contains the actual salary values of an employee. The basic row will then be multiplied for budgeting and forecast reasons max. 25 times(=months) or less if an employee leaves before the end of the budgeting period. 
&lt;BR /&gt;I was experimenting a little over the weekend and changed the job in the process a little. The loop is now a For-Loop. Now it is basically working with the exception that the context variable (= max. amount of loops) is always taken from the last employee. Therefore if the calculated number of loops is 25, the loop will run 25 times for all the employees. If the calculated number of loops is 6 then it will run 6 times per employee for all employees. 
&lt;BR /&gt;Now my problem is, how can I assign the "To"-variable of the loop with the calculated value for the number of loops for every employee individually? The "To"-Value of the loop contains the variable "context.iterationCount", it's just the value of the context variable which is wrong. The loop should run for example like this: 
&lt;BR /&gt;- 1. employee&amp;nbsp; --&amp;gt; 25 times 
&lt;BR /&gt;- 2. employee&amp;nbsp; --&amp;gt; 25 times 
&lt;BR /&gt;- 3. employee&amp;nbsp; --&amp;gt; 4 times 
&lt;BR /&gt;==&amp;gt; This should result in a total number of rows of 54, with the actual setting it does it only 12 times 
&lt;BR /&gt;- 1. employee&amp;nbsp; --&amp;gt; 25 times 
&lt;BR /&gt;- 2. employee&amp;nbsp; --&amp;gt; 25 times 
&lt;BR /&gt;- 3. employee&amp;nbsp; --&amp;gt; 4 times 
&lt;BR /&gt;- 4. employee&amp;nbsp; --&amp;gt; 25 times 
&lt;BR /&gt;==&amp;gt; This should result in a total number of rows of 79, with the actual setting it does it 100 times 
&lt;BR /&gt;Below you'll find the printscreen of the new job. In this example the total amount of rows written into the MS SQL DB should be 79 and not 100. 
&lt;BR /&gt; 
&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/178555/blob_20141027-0929.png" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MB5y.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/142446iE88587697BBCBB15/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MB5y.png" alt="0683p000009MB5y.png" /&gt;&lt;/span&gt; &lt;/A&gt; 
&lt;BR /&gt;Hope, you could give me a hint of how to make it work correctly. 
&lt;BR /&gt;Regards, Felix</description>
      <pubDate>Mon, 27 Oct 2014 08:41:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-while-loop-with-several-conditions/m-p/2292178#M65285</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-27T08:41:15Z</dc:date>
    </item>
  </channel>
</rss>

