<?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: RowNumber for group of value in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/RowNumber-for-group-of-value/m-p/2280384#M55246</link>
    <description>&lt;P&gt;I assume that you posted this to show how you got you job to work?&lt;/P&gt;</description>
    <pubDate>Mon, 03 Feb 2020 15:45:12 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-02-03T15:45:12Z</dc:date>
    <item>
      <title>RowNumber for group of value</title>
      <link>https://community.qlik.com/t5/Talend-Studio/RowNumber-for-group-of-value/m-p/2280380#M55242</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have this situation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Key&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;C&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want compute the rowId, mantaining the same value for the same key. Sample of expected output value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Key&amp;nbsp; &amp;nbsp; RowId&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;C&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;D&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4&lt;/P&gt;&lt;P&gt;D&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 11:00:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/RowNumber-for-group-of-value/m-p/2280380#M55242</guid>
      <dc:creator>EV89</dc:creator>
      <dc:date>2020-02-03T11:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: RowNumber for group of value</title>
      <link>https://community.qlik.com/t5/Talend-Studio/RowNumber-for-group-of-value/m-p/2280381#M55243</link>
      <description>&lt;P&gt;You can do this with a tJavaFlex component. The code you will need looks like below....&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;Start Code&lt;/STRONG&gt;&lt;/P&gt; 
&lt;PRE&gt;&lt;STRONG&gt;// start part of your Java code
int rowNum = 0;&lt;/STRONG&gt;&lt;/PRE&gt; 
&lt;P&gt;&lt;STRONG&gt;Main Code&lt;/STRONG&gt;&lt;/P&gt; 
&lt;PRE&gt;// here is the main part of the component,
// a piece of code executed in the row
// loop
String value = row1.Key;

if(globalMap.get(value)==null){
	rowNum = rowNum+1;
	globalMap.put(value, rowNum);
}

row2.RowId = ((Integer)globalMap.get(value)).intValue();&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;What the above is doing is keeping a track of the RowId count using the "rowNum" created in the Start Code section. Then, it is creating a globalMap key/value pair for every "Key" in your data. Once the "Key" is created once, it is assigned the current "rowNum" which is appended by 1. Every time that "Key" is seen again, it is assigned the value stored in the globalMap.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 11:24:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/RowNumber-for-group-of-value/m-p/2280381#M55243</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-03T11:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: RowNumber for group of value</title>
      <link>https://community.qlik.com/t5/Talend-Studio/RowNumber-for-group-of-value/m-p/2280382#M55244</link>
      <description>&lt;P&gt;I should point out that I used the globalMap because it was easy. It might be better to create your own HashMap object to store these values in. This will protect against you accidentally affecting other key/value pairs that the globalMap might hold.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 11:26:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/RowNumber-for-group-of-value/m-p/2280382#M55244</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-03T11:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: RowNumber for group of value</title>
      <link>https://community.qlik.com/t5/Talend-Studio/RowNumber-for-group-of-value/m-p/2280383#M55245</link>
      <description>&lt;P&gt;My execution&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009Lx9r"&gt;Job.png&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LxMX"&gt;Start.png&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LxU0"&gt;Main.png&lt;/A&gt;</description>
      <pubDate>Mon, 03 Feb 2020 14:51:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/RowNumber-for-group-of-value/m-p/2280383#M55245</guid>
      <dc:creator>EV89</dc:creator>
      <dc:date>2020-02-03T14:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: RowNumber for group of value</title>
      <link>https://community.qlik.com/t5/Talend-Studio/RowNumber-for-group-of-value/m-p/2280384#M55246</link>
      <description>&lt;P&gt;I assume that you posted this to show how you got you job to work?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 15:45:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/RowNumber-for-group-of-value/m-p/2280384#M55246</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-03T15:45:12Z</dc:date>
    </item>
  </channel>
</rss>

