<?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: How to iterate through csv and read row by row and assigning them in tJavaRow in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252724#M36282</link>
    <description>&lt;P&gt;OK, you need to understand the strict flow here. For every row from your first file, every row of your second file will be returned. That is how iterate links work. You cannot force subsequent rows from the first file in middle of an iteration. If you first file has two rows of data (holding values "1" and "2") and your second file has 4 rows (holding values "a", "b", "c" and "d") and if you ran them through your configuration, the rough permutations of data would be below....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"1", "a"&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"1", "b"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"1", "c"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"1", "d"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;"2", "a"&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"2", "b"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"2", "c"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"2", "d"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I suspect you might need to use a tMap to join your data from your files and perform your logic there.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 17 Nov 2018 14:10:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-11-17T14:10:32Z</dc:date>
    <item>
      <title>How to iterate through csv and read row by row and assigning them in tJavaRow</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252717#M36275</link>
      <description>&lt;P&gt;I have a flow below where I am reading the csv file&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tFileInputDelimited_1 -&amp;gt; tFlowtoIterate -&amp;gt; tJavaFlex -&amp;gt; tFileInputDelimited_2 -&amp;gt; tJavaRow -&amp;gt; tFlowToIterate -&amp;gt; tHiveInput -&amp;gt; tFileOutputDelimited.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am preparing a SQL query using above flow and sending it to Hive.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have delimited data in tFileInputDelimited_1 which i wanted to iterate through and assign them in tJavaFlex and tJavaRow accordingly (i.e. to contextVariables).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For each row field in csv (tFileInputDelimited_1), which matches a condition(i.e. based in tFileInputDelimited_2), i want to assign to context variables accordingly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;tFileInputDelimited_1:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;123-D1-abc-rtey121-a1b1-1416&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;123-D1-abc-bd2tr-a1y14-&lt;/SPAN&gt;&lt;SPAN&gt;1311&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;141-B1-fhf--a1fb32-utoot21b-157&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;141-B1-fhf--vefb32-utoot21b-&lt;/SPAN&gt;&lt;SPAN&gt;157&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;141-B1-fhf--k191-utoot21b-157&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;456575-C1-21-ytuueoro-ghfyt-43&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;456575-C1-21-ytuueoro-ghfyt-43&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;4567-B1-abc-grth-a1b1-1287&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tFileInputDelimited_2:&lt;/P&gt;&lt;P&gt;sno,section_name,col_1,col_2,col_3&lt;/P&gt;&lt;P&gt;1, section_name_1,&amp;lt;string_a1&amp;gt;,&amp;lt;string_a2&amp;gt;,&amp;lt;string_a3&amp;gt;&lt;/P&gt;&lt;P&gt;2, section_name_2,&amp;lt;string_b1&amp;gt;,&lt;SPAN&gt;&amp;lt;string_b2&amp;gt;,&amp;lt;string_b3&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code in tJavaRow:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;String v_filter = ""

if(input_row.sno == 1 &amp;amp;&amp;amp; input_row.name.equals("section_name_1")) /* conditions from tFileInputDelimited_2*/
{
    &lt;FONT color="#FF0000"&gt;while((String)globalMap.get("row.line")&lt;/FONT&gt; != null) /*lines from tFileInputDelimited_1*/
    {
      //the below code should loop&amp;nbsp;
      if (context.AP_CODE.equals("D1") &amp;amp;&amp;amp; context.I_NAME.equals("abc"))
      {
         v_filter = "AP_CODE_V =" + "'" + context.AP_CODE_V + "'"
          + " AND I_NAME_V=" + "'" + context.I_NAME_V + "'"
          + " AND&amp;nbsp;ID_V =" + context.ID_V 
      } 
    } 
} 
..&lt;BR /&gt;..&lt;BR /&gt;
I need output like below (i.e. for each matching condition).. 
AP_CODE_V = 'rtey121'&lt;BR /&gt;I_NAME_V = 'a1b1'&lt;BR /&gt;ID_V = 1416&lt;BR /&gt;&lt;BR /&gt;AP_CODE_V = 'bd2tr'&lt;BR /&gt;I_NAME_V = 'a1y14'&lt;BR /&gt;ID_V = 1311&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Problem is that I am able print only first set. I am not able to loop through other set of values(Seems like while condition is not working).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me, where i am doing wrong.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: I thought of organizing these files in JSON, so that it would be easy to parse through and iterate. but some how started with delimited files to get some quick turn-around.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 07:16:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252717#M36275</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T07:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to iterate through csv and read row by row and assigning them in tJavaRow</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252718#M36276</link>
      <description>I think we'll need to see the component linkages to help with this. The issue seems to be that globalMap.get("row.line") isn't iterating through the rows correctly: are you sending it an Iterate? Your workflow is:
&lt;BR /&gt;
&lt;BR /&gt;tFileInputDelimited_1 -&amp;gt; tFlowtoIterate -&amp;gt; tJavaFlex -&amp;gt; tFileInputDelimited_2 -&amp;gt; tJavaRow -&amp;gt; tFlowToIterate -&amp;gt; tHiveInput -&amp;gt; tFileOutputDelimited.
&lt;BR /&gt;
&lt;BR /&gt;which has other components between the tFlowtoIterate and tJavaRow. Or is the code you posted from tJavaFlex?</description>
      <pubDate>Thu, 15 Nov 2018 21:34:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252718#M36276</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-15T21:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to iterate through csv and read row by row and assigning them in tJavaRow</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252719#M36277</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/0053p000007LM4pAAG"&gt;@DVSCHWAB&lt;/A&gt;,&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The flow is same as mentioned.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;1) tFileInputDelimited_1 -&amp;gt; has the test data as mentioned. I connected this to tFlowtoIterate&lt;/P&gt; 
&lt;P&gt;2) tJavaFlex -&amp;gt; I am assigning the above test data to context variables. (i have no other code here apart from variable assignment)&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;3) tFileInputDelimited_2 -&amp;gt; has the data (as mentioned above) to form the SQL query template.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;4) tFlowtoIterate_1 -&amp;gt; connects to tJavaRow to loop the data&lt;/P&gt; 
&lt;P&gt;5) tJavarow_1 -&amp;gt; this is where my logic to assign test data from tFileInputDelimited_1 to template in tFileInputDelimited_2 (i.e. the code which i poisted)&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 594px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M1R6.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/144959i58399F112A4BCB86/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M1R6.png" alt="0683p000009M1R6.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 02:56:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252719#M36277</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-16T02:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to iterate through csv and read row by row and assigning them in tJavaRow</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252720#M36278</link>
      <description>&lt;P&gt;Any update ? Please let me know..&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;CC:&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 10:15:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252720#M36278</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-16T10:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to iterate through csv and read row by row and assigning them in tJavaRow</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252721#M36279</link>
      <description>&lt;P&gt;What data are you intending to loop in your tJavaRow?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 16:30:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252721#M36279</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-16T16:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to iterate through csv and read row by row and assigning them in tJavaRow</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252722#M36280</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;tFileInputDelimited_1:&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;123-D1-abc-rtey121-a1b1-1416&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;123-D1-abc-bd2tr-a1y14-&lt;/SPAN&gt;&lt;SPAN&gt;1311&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;141-B1-fhf--a1fb32-utoot21b-157&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;141-B1-fhf--vefb32-utoot21b-&lt;/SPAN&gt;&lt;SPAN&gt;157&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;141-B1-fhf--k191-utoot21b-157&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;456575-C1-21-ytuueoro-ghfyt-43&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;456575-C1-21-ytuueoro-ghfyt-43&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;4567-B1-abc-grth-a1b1-1287&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;tFileInputDelimited_2:&lt;/P&gt; 
&lt;P&gt;sno,section_name,col_1,col_2,col_3&lt;/P&gt; 
&lt;P&gt;1, section_name_1,&amp;lt;string_a1&amp;gt;,&amp;lt;string_a2&amp;gt;,&amp;lt;string_a3&amp;gt;&lt;/P&gt; 
&lt;P&gt;2, section_name_2,&amp;lt;string_b1&amp;gt;,&lt;SPAN&gt;&amp;lt;string_b2&amp;gt;,&amp;lt;string_b3&amp;gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;eg:- I want to loop over 2 times on tFileInputDelimited_1, if (sno == 1 &amp;amp;&amp;amp; sec_name_1) from tFileInputDelimited_2 and while((context.AP_CODE.equals("D1") &amp;amp;&amp;amp; context.I_NAME.equals("abc"))) //based on matching criteria from each line. (i..e D1 and abc)&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;i.e.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;123-D1-abc-rtey121-a1b1-1416&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;123-D1-abc-bd2tr-a1y14-&lt;/SPAN&gt;&lt;SPAN&gt;1311&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;so that I will get output like this (i.e., the values which i need based on matching condition)..&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;AP_CODE_V = 'rtey121'&lt;BR /&gt;I_NAME_V = 'a1b1'&lt;BR /&gt;ID_V = 1416&lt;BR /&gt;&lt;BR /&gt;AP_CODE_V = 'bd2tr'&lt;BR /&gt;I_NAME_V = 'a1y14'&lt;BR /&gt;ID_V = 1311&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;Unfortunately, I don't have a join condition to match between these two files.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Similarly For,&amp;nbsp;&lt;SPAN&gt;(sno == 2 &amp;amp;&amp;amp; sec_name_2) and&amp;nbsp;while((context.AP_CODE.equals("B1") &amp;amp;&amp;amp; context.I_NAME.equals("fhf")))&lt;/SPAN&gt;&lt;/P&gt; 
&lt;PRE&gt;AP_CODE_V = 'a1fb32'
I_NAME_V = 'utoot21b'
ID_V = 157

AP_CODE_V = 'vefb32'
I_NAME_V = 'utoot21b'
ID_V = 157

AP_CODE_V = 'k191'
I_NAME_V = 'utoot21b'
ID_V = 157&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Nov 2018 17:57:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252722#M36280</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-16T17:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to iterate through csv and read row by row and assigning them in tJavaRow</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252723#M36281</link>
      <description>Please let me know where I am doing wrong! I am not sure if I am doing wrong in while condition, I.e to loop over tFileInputDelimited_1 (to retrieve only that row which satisfies the 2nd if condition)?&lt;BR /&gt;&lt;BR /&gt;(or) should I use tJavaFlex instead of tJavarow for this purpose?</description>
      <pubDate>Sat, 17 Nov 2018 12:22:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252723#M36281</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-17T12:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to iterate through csv and read row by row and assigning them in tJavaRow</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252724#M36282</link>
      <description>&lt;P&gt;OK, you need to understand the strict flow here. For every row from your first file, every row of your second file will be returned. That is how iterate links work. You cannot force subsequent rows from the first file in middle of an iteration. If you first file has two rows of data (holding values "1" and "2") and your second file has 4 rows (holding values "a", "b", "c" and "d") and if you ran them through your configuration, the rough permutations of data would be below....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"1", "a"&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"1", "b"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"1", "c"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"1", "d"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;"2", "a"&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"2", "b"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"2", "c"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"2", "d"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I suspect you might need to use a tMap to join your data from your files and perform your logic there.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Nov 2018 14:10:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252724#M36282</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-17T14:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to iterate through csv and read row by row and assigning them in tJavaRow</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252725#M36283</link>
      <description>I confess that I'm not sure why your code isn't working; it looks correct to me. At this point, what I would do (if this were my project) is create a new job with only the tfileDelimited2 and tJavaRow and see if it works (output to tLogRow). If it does, add back the other components one at a time until you find the source of the problem (if it doesn't work with just the minimal components, strip the Java code down to the bare minimum to prove the functionality exists).
&lt;BR /&gt;
&lt;BR /&gt;Best of luck,
&lt;BR /&gt;
&lt;BR /&gt;David</description>
      <pubDate>Sat, 17 Nov 2018 14:14:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-iterate-through-csv-and-read-row-by-row-and-assigning/m-p/2252725#M36283</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-17T14:14:52Z</dc:date>
    </item>
  </channel>
</rss>

