<?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 [resolved] Iterate differing variables to component in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-Iterate-differing-variables-to-component/m-p/2196471#M615</link>
    <description>Hi all, 
&lt;BR /&gt;Simple question without much introduction needed for it - Let's say I have 48 different variables (taken from a list of ID numbers) and I need an input component to look up a URL based on each individual ID number - Hence I need each ID as a variable to automate the job (the ID's change daily). 
&lt;BR /&gt;So inside my input I have ' "URL.LINK&amp;amp;" +globalMap.get("ID_value_"+globalMap.get("V")) ' as the link. But how do I iterate V = 1,2,3 etc into the component? 
&lt;BR /&gt;I have a clever java loop which saves each ID as ID_value_N for however many N integer values needed, but I cannot think of a way of importing that into a single file-name path. 
&lt;BR /&gt;Any help is appreciated. 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;V Pem.</description>
    <pubDate>Tue, 17 Mar 2015 10:50:56 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-03-17T10:50:56Z</dc:date>
    <item>
      <title>[resolved] Iterate differing variables to component</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Iterate-differing-variables-to-component/m-p/2196471#M615</link>
      <description>Hi all, 
&lt;BR /&gt;Simple question without much introduction needed for it - Let's say I have 48 different variables (taken from a list of ID numbers) and I need an input component to look up a URL based on each individual ID number - Hence I need each ID as a variable to automate the job (the ID's change daily). 
&lt;BR /&gt;So inside my input I have ' "URL.LINK&amp;amp;" +globalMap.get("ID_value_"+globalMap.get("V")) ' as the link. But how do I iterate V = 1,2,3 etc into the component? 
&lt;BR /&gt;I have a clever java loop which saves each ID as ID_value_N for however many N integer values needed, but I cannot think of a way of importing that into a single file-name path. 
&lt;BR /&gt;Any help is appreciated. 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;V Pem.</description>
      <pubDate>Tue, 17 Mar 2015 10:50:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Iterate-differing-variables-to-component/m-p/2196471#M615</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-17T10:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Iterate differing variables to component</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Iterate-differing-variables-to-component/m-p/2196472#M616</link>
      <description>where is the value of V stored?</description>
      <pubDate>Tue, 17 Mar 2015 12:01:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Iterate-differing-variables-to-component/m-p/2196472#M616</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-17T12:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Iterate differing variables to component</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Iterate-differing-variables-to-component/m-p/2196473#M617</link>
      <description>Not entirely sure..? In the workings of talends variables. Here is the code from my tJavaRow that produces the entire variable:&lt;BR /&gt;Integer Y = (Integer)globalMap.get("N");&lt;BR /&gt;globalMap.put("film_edi_"+Y, input_row.film_edi);&lt;BR /&gt;globalMap.put("N", new Integer(Y.intValue() + 1));&lt;BR /&gt;&lt;BR /&gt;Apologies, it is Y, not V - Regardless, it doesn't really matter. How would I iterate the differing value into the input component? Since, at the end of the Java component, Y is set to 48. How would I iterate it through all the integer values going INTO the input? Essentially, how do I loop the input to run mutliple times?</description>
      <pubDate>Tue, 17 Mar 2015 12:18:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Iterate-differing-variables-to-component/m-p/2196473#M617</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-17T12:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Iterate differing variables to component</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Iterate-differing-variables-to-component/m-p/2196474#M618</link>
      <description>Hi&amp;nbsp; 
&lt;BR /&gt;If you want to iterate number from 1 to Y (it is 48 for example) and send it as a parameter to the next processing, you can use tLoop component to a loop. For example: 
&lt;BR /&gt;your other component--main(row1)--tJavaFlex (Here I use tJavaFlex to replace tJavaRow) 
&lt;BR /&gt;&amp;nbsp; &amp;nbsp; | 
&lt;BR /&gt;onsubjobok 
&lt;BR /&gt;&amp;nbsp; &amp;nbsp; | 
&lt;BR /&gt;tLoop--iterate--tJava--oncomponentok--your other processing. 
&lt;BR /&gt;on tJavaFlex: 
&lt;BR /&gt;in the beginning part 
&lt;BR /&gt; 
&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;Integer Y=0;&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;in the main part: 
&lt;BR /&gt; 
&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;Y = (Integer)globalMap.get("N");&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;globalMap.put("film_edi_"+Y, row1.film_edi);&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;globalMap.put("N", new Integer(Y.intValue() + 1));&lt;/FONT&gt;&lt;/FONT&gt;&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;in the end part, store the value of Y to a context variable called Y for use later. 
&lt;BR /&gt;on tLoop, set Condition field with a context variable called condition. 
&lt;BR /&gt; 
&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/674/1_20150317-1352.png" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MD7z.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/144718iBB0AB80614350E02/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MD7z.png" alt="0683p000009MD7z.png" /&gt;&lt;/span&gt; &lt;/A&gt; 
&lt;BR /&gt;on tJava: 
&lt;BR /&gt; 
&lt;PRE&gt;int current_iterate=((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION"));&lt;BR /&gt;if(current_iterate&amp;lt;context.Y){&lt;BR /&gt;context.condition=true;&lt;BR /&gt;}else{&lt;BR /&gt;context.condition=false;&lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;//the current value of Y can be accessed with this expression in your other processing: 
&lt;BR /&gt; 
&lt;FONT face="consolas, monaco, 'bitstream vera sans mono', 'courier new', courier, monospace"&gt;((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION"))&lt;/FONT&gt; 
&lt;BR /&gt;I am not sure I understand your request completely, but hope that it might give you some tips to use tLoop to do a loop. 
&lt;BR /&gt;BR 
&lt;BR /&gt;Shong</description>
      <pubDate>Tue, 17 Mar 2015 12:53:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Iterate-differing-variables-to-component/m-p/2196474#M618</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-17T12:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Iterate differing variables to component</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Iterate-differing-variables-to-component/m-p/2196475#M619</link>
      <description>Waaahooooo!! Finally got it! Thank you Shong. tLoop was EXACTLY what I needed. Such a simple answer and it took me so long to find it haha. 
&lt;BR /&gt;I probably could have done it your way, but I changed it slightly - For the purpose of others I will detail below, thanks again. 
&lt;BR /&gt;So after my initial Java loop which sets the variables ID_value_N for all integer values N required, I did onSubjobOkay --&amp;gt; tLoop --Iterate--&amp;gt; tJava --OnComponentOkay--&amp;gt; Other part of my job. 
&lt;BR /&gt;Inside the tLoop I did: 
&lt;BR /&gt;Loop Type: For 
&lt;BR /&gt;From 1 
&lt;BR /&gt;To (Integer)globalMap.get("N") -1 
&lt;BR /&gt;Step 1 
&lt;BR /&gt;This makes sense if you look at the code for my tJavaFlow which sets the initial value Y from the integer N as follows: 
&lt;BR /&gt;Integer Y = (Integer)globalMap.get("N"); 
&lt;BR /&gt;globalMap.put("N", new Integer(Y.intValue() + 1)); 
&lt;BR /&gt;This means that after it sets the final variable ID_value_48, it sets the value N as 49 before finishing the component, hence the -1 in the tLoop. 
&lt;BR /&gt; 
&lt;BR /&gt;As for the tJava, I do the following: 
&lt;BR /&gt;Integer W = (Integer)globalMap.get("V"); 
&lt;BR /&gt;globalMap.put("V", new Integer(W.intValue() + 1)); 
&lt;BR /&gt;Similar loop as to the one above, simply giving me a new value to play with so I needn't interfer with the original variable N (for safety reasons). Then I call upon the variable ' +globalMap.get("ID_value_"+globalMap.get("V")) ' in my input component after the tJava which iterates through the values as a result of the tLoop... Awesome! 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;Note: If anyone does a similar thing, make sure to do 'Append' in the output, as I initially over-wrote my file several times before realising what I was doing haha. 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;V Pem.</description>
      <pubDate>Tue, 17 Mar 2015 13:44:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Iterate-differing-variables-to-component/m-p/2196475#M619</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-17T13:44:04Z</dc:date>
    </item>
  </channel>
</rss>

