<?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 test a value on a previous line? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374577#M137157</link>
    <description>To generate a correlation key, use tjavarow and follow the concept in my post 
&lt;BR /&gt; 
&lt;A href="https://community.qlik.com/s/feed/0D53p00007vCprlCAC" rel="nofollow noopener noreferrer"&gt;https://community.talend.com/t5/Design-and-Development/Multiple-Record-Type/td-p/104947&lt;/A&gt; 
&lt;BR /&gt;of course it assumes the source is ordered 
&lt;BR /&gt;hope it helps</description>
    <pubDate>Wed, 17 Feb 2010 10:39:18 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2010-02-17T10:39:18Z</dc:date>
    <item>
      <title>How to test a value on a previous line?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374576#M137156</link>
      <description>I am using TOS to add a colum to a flat file.
&lt;BR /&gt;Working with 
&lt;BR /&gt;Talend Open Studio Version: 4.0.0M2 - Build id: r35653-20100114-0503
&lt;BR /&gt;OS: Microsoft Windows Server 2003 Stabdad x64 Edition Service Pack 2
&lt;BR /&gt;Java
&lt;BR /&gt;The input file has several colums, and the output file should have the same colums in a different places and in addition one more colums called DNOR. For my exemple, I only show 1 colum and the DNOR one.
&lt;BR /&gt;The added column called DNOR in my exemple has a type integer. 
&lt;BR /&gt;The DNOR value starts at 1 for the first line and should be increased by 1 each time the value of the colums called ACCOUNT is different from the previous line.
&lt;BR /&gt;Therefore the rules is as follows:
&lt;BR /&gt;If the ACCOUNT_Current_Line!=ACCOUNT_Previous_Line then DNOR++
&lt;BR /&gt;
&lt;BR /&gt;INPUT file description
&lt;BR /&gt;ACCOUNT;
&lt;BR /&gt;641100;
&lt;BR /&gt;641100;
&lt;BR /&gt;641100;
&lt;BR /&gt;421000;
&lt;BR /&gt;421000;
&lt;BR /&gt;841999;
&lt;BR /&gt;841999;
&lt;BR /&gt;841999;
&lt;BR /&gt;841999;
&lt;BR /&gt;
&lt;BR /&gt;OUTPUT file description exemple
&lt;BR /&gt;ACCOUNT;DNOR;
&lt;BR /&gt;641100;1;
&lt;BR /&gt;641100;1;
&lt;BR /&gt;641100;1;
&lt;BR /&gt;421000;2;
&lt;BR /&gt;421000;2;
&lt;BR /&gt;841999;3;
&lt;BR /&gt;841999;3;
&lt;BR /&gt;841999;3;
&lt;BR /&gt;841999;3;
&lt;BR /&gt;I did read the documentation for several inegrated fonction of TOS, and look for the same problematic in the forum but I did not find the clue to implement this. I try using the tJavaRow, the tFilterRow and the tMap, but did not succeed each time when I try to get the ACCOUNT_Previous_Line value.
&lt;BR /&gt;If someone can give me the entry point on how to handle such request, I would be very gratefull.
&lt;BR /&gt;Regards 
&lt;BR /&gt;Aymeric</description>
      <pubDate>Sat, 16 Nov 2024 13:32:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374576#M137156</guid>
      <dc:creator>amounier</dc:creator>
      <dc:date>2024-11-16T13:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to test a value on a previous line?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374577#M137157</link>
      <description>To generate a correlation key, use tjavarow and follow the concept in my post 
&lt;BR /&gt; 
&lt;A href="https://community.qlik.com/s/feed/0D53p00007vCprlCAC" rel="nofollow noopener noreferrer"&gt;https://community.talend.com/t5/Design-and-Development/Multiple-Record-Type/td-p/104947&lt;/A&gt; 
&lt;BR /&gt;of course it assumes the source is ordered 
&lt;BR /&gt;hope it helps</description>
      <pubDate>Wed, 17 Feb 2010 10:39:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374577#M137157</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-02-17T10:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to test a value on a previous line?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374578#M137158</link>
      <description>Thanks for your replay emaxt6, I look at your post 7663, and I understand the concept however, in my case, I do not have a fixed string to test, in order to increase or not my SYNTHKEY. in place of the following if test:
&lt;BR /&gt;if(input_row.Col1.equals("G203")) {
&lt;BR /&gt;//gen new key and store it
&lt;BR /&gt;mykey++;
&lt;BR /&gt;
&lt;BR /&gt;I am looking for a test I could do on the previous row for exemple
&lt;BR /&gt;if(input_row.Col1.equals(input_row.Col1_PREVIOUS_ROW")) {
&lt;BR /&gt;//gen new key and store it
&lt;BR /&gt;mykey++;
&lt;BR /&gt;The trouble is that I do not manage to use the global variable in order to compare the previous row value to the current row value. Any idea on how to emplement this in the tJavaRow or better directly in the tMap?</description>
      <pubDate>Wed, 17 Feb 2010 11:43:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374578#M137158</guid>
      <dc:creator>amounier</dc:creator>
      <dc:date>2010-02-17T11:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to test a value on a previous line?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374579#M137159</link>
      <description>try this as start:&lt;BR /&gt;------&lt;BR /&gt;int mykey = (Integer)(globalMap.get("MYKEY") == null ? 0 : globalMap.get("MYKEY"));&lt;BR /&gt;String prev = (String)(globalMap.get("PREV") == null ? "&amp;lt; __NULL_!!__&amp;gt;" : globalMap.get("PREV"));&lt;BR /&gt;if(!input_row.MYFIELD.equals(prev)) {&lt;BR /&gt;//gen new key and store it&lt;BR /&gt;mykey++;&lt;BR /&gt;prev = input_row.MYFIELD;&lt;BR /&gt;globalMap.put("MYKEY", mykey);&lt;BR /&gt;globalMap.put("PREV", prev);&lt;BR /&gt;}&lt;BR /&gt;output_row.MYFIELD = input_row.MYFIELD;&lt;BR /&gt;output_row.MYKEY = mykey;&lt;BR /&gt;-----</description>
      <pubDate>Wed, 17 Feb 2010 12:30:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374579#M137159</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-02-17T12:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to test a value on a previous line?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374580#M137160</link>
      <description>Dear emaxt6, 
&lt;BR /&gt;Thanks so much, this is working very well and I manage to adapt a little your code, this produice exactly what I wanted. 
&lt;BR /&gt;Thanks again and thnaks for your time and effort. 
&lt;BR /&gt;Regards 
&lt;BR /&gt;Aymeric</description>
      <pubDate>Wed, 17 Feb 2010 14:33:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374580#M137160</guid>
      <dc:creator>amounier</dc:creator>
      <dc:date>2010-02-17T14:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to test a value on a previous line?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374581#M137161</link>
      <description>You are welcome.
&lt;BR /&gt;Anyway I think that would be very useful if Talend would consider to provide a component ie. named tPreviousRecords, that a user can put inline in a flow from the gui and such component will "memorize" up to n previuos records (default one record) that a user can then simply refer in other components in the job (ie. tmap) as other component published variables.
&lt;BR /&gt;Does someone at Talend agree? It would solve a lot of use cases and provide great flexibility.
&lt;BR /&gt;thanks</description>
      <pubDate>Sun, 21 Feb 2010 14:22:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374581#M137161</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-02-21T14:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to test a value on a previous line?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374582#M137162</link>
      <description>Feature requested and handled by Talend very fast&lt;BR /&gt;&lt;A href="http://www.talendforge.org/bugs/view.php?id=11720" rel="nofollow noopener noreferrer"&gt;http://www.talendforge.org/bugs/view.php?id=11720&lt;/A&gt;&lt;BR /&gt;thanks</description>
      <pubDate>Tue, 13 Apr 2010 12:54:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-test-a-value-on-a-previous-line/m-p/2374582#M137162</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-04-13T12:54:46Z</dc:date>
    </item>
  </channel>
</rss>

