<?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 replace null values with earlier row's values in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362838#M126895</link>
    <description>ps!!&lt;BR /&gt;I thought so 2 ..that the code should work.&lt;BR /&gt;But i dont see any change in the o/p it is being displayed just as the input.As if the code did not execute!&lt;BR /&gt;Do i have to check anything to get the code considered.&lt;BR /&gt;I just have an inputdelimitedfile--&amp;gt;tJavaRow--&amp;gt;tLogRow&lt;BR /&gt;The tLogRow has the same o/p as i/p</description>
    <pubDate>Fri, 06 Jan 2012 20:39:11 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-01-06T20:39:11Z</dc:date>
    <item>
      <title>how to replace null values with earlier row's values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362834#M126891</link>
      <description>hi,&lt;BR /&gt;I am having data like &lt;BR /&gt;accountno    acctname  acctdefn&lt;BR /&gt;--------------------------------------&lt;BR /&gt;AS123456    savings     saving acct&lt;BR /&gt;                  deposit     deposit acct&lt;BR /&gt;                  transfer    transfer acct&lt;BR /&gt;BS789101   savings     saving acct&lt;BR /&gt;                  transfer    transfer acct&lt;BR /&gt;in this data, the 2nd and 3rd rows won't contain data for account no. so, It has to replace with the previous row not null value( 1st row data of accountno i.e, AS123456).&lt;BR /&gt;same as, 5th row won't contain data for accountno, so it has to replace with the previous row not null value (4th row account no).&lt;BR /&gt;i want data like&lt;BR /&gt;accountno    acctname  acctdefn&lt;BR /&gt;--------------------------------------&lt;BR /&gt;AS123456    savings     saving acct&lt;BR /&gt;AS123456    deposit     deposit acct&lt;BR /&gt;AS123456    transfer    transfer acct&lt;BR /&gt;BS789101    savings    saving acct&lt;BR /&gt;BS789101    transfer    transfer acct&lt;BR /&gt;please reply.</description>
      <pubDate>Sat, 16 Nov 2024 12:28:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362834#M126891</guid>
      <dc:creator>raj99</dc:creator>
      <dc:date>2024-11-16T12:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to replace null values with earlier row's values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362835#M126892</link>
      <description>you could easily do this with the globalMap and a tJavaRow component. 
&lt;BR /&gt;The idea would be for every column to check if the row value is null, and then either save it or replace with the previous not null value. for a schema of one column (COLUMN_NAME) it would look like this:
&lt;BR /&gt;
&lt;PRE&gt;if( input_row.COLUMN_NAME != null ) {&lt;BR /&gt;        //input row is NOT NULL, cache this row value in globalMap and assign to output row&lt;BR /&gt;        globalMap.put("COLUMN_NAME", input_row.COLUMN_NAME);&lt;BR /&gt;        output_row.COLUMN_NAME = input_row.COLUMN_NAME;&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt;       //input column IS NULL. retrieve previous row value from globalMap&lt;BR /&gt;       //if this is the first row, the globalMap will not be populated, so check if the key exists and if not, assign default value&lt;BR /&gt;       if( (String)globalMap.get("COLUMN_NAME") != null ) {&lt;BR /&gt;           output_row.COLUMN_NAME = (String)globalMap.get("COLUMN_NAME");&lt;BR /&gt;       }&lt;BR /&gt;       else {&lt;BR /&gt;           output_row.COLUMN_NAME = "DEFAULT VALUE";&lt;BR /&gt;       }&lt;BR /&gt;}&lt;/PRE&gt;
&lt;BR /&gt;edit: There is also a component "tMemorizeRows" that may be helpful. I am not familiar with it, so Im not sure it will help-- but it seems like it might be worth a look.</description>
      <pubDate>Fri, 06 Jan 2012 19:08:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362835#M126892</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-06T19:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to replace null values with earlier row's values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362836#M126893</link>
      <description>you may have to store your ac nos locally . 
&lt;BR /&gt; 
&lt;BR /&gt;Should this work ? @JohnGarrettMartin 
&lt;BR /&gt; 
&lt;PRE&gt;if(input_row.accountno != null)&lt;BR /&gt;{&lt;BR /&gt;	//globalMap.put("col1", input_row.accountno);&lt;BR /&gt;	globalMap.put("col1", input_row.accountno);&lt;BR /&gt;	output_row.accountno = input_row.accountno;&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;	if((String)globalMap.get("col1") != null)&lt;BR /&gt;		output_row.accountno = (String)globalMap.get("col1");&lt;BR /&gt;	else&lt;BR /&gt;		output_row.accountno = "NO VALUE";&lt;BR /&gt;}&lt;BR /&gt;output_row.acctname = input_row.acctname;&lt;BR /&gt;output_row.acctdefn = input_row.acctdefn;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Jan 2012 19:49:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362836#M126893</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-06T19:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to replace null values with earlier row's values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362837#M126894</link>
      <description>should work fine except that I would reject this code due to the lack of brackets around your inner if/else. 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MA9p.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/138034i5F552429DA646D6F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MA9p.png" alt="0683p000009MA9p.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Fri, 06 Jan 2012 20:29:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362837#M126894</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-06T20:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to replace null values with earlier row's values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362838#M126895</link>
      <description>ps!!&lt;BR /&gt;I thought so 2 ..that the code should work.&lt;BR /&gt;But i dont see any change in the o/p it is being displayed just as the input.As if the code did not execute!&lt;BR /&gt;Do i have to check anything to get the code considered.&lt;BR /&gt;I just have an inputdelimitedfile--&amp;gt;tJavaRow--&amp;gt;tLogRow&lt;BR /&gt;The tLogRow has the same o/p as i/p</description>
      <pubDate>Fri, 06 Jan 2012 20:39:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362838#M126895</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-06T20:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to replace null values with earlier row's values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362839#M126896</link>
      <description>do you have any null values in your "accountno" column? if there are none, then the code would appear to not do anything-- which is how it should work.</description>
      <pubDate>Fri, 06 Jan 2012 20:50:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362839#M126896</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-06T20:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to replace null values with earlier row's values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362840#M126897</link>
      <description>hi, &lt;BR /&gt;thanks and it works.&lt;BR /&gt;i am having another issue, &lt;BR /&gt;if I have data like &lt;BR /&gt;;saving;saving acct&lt;BR /&gt;;transfers;transfer acct&lt;BR /&gt;AS123456;deposits;deposits acct&lt;BR /&gt;;peti;peti acct&lt;BR /&gt;PT7891011;saving;saving acct&lt;BR /&gt;and I want data likes&lt;BR /&gt;AS123456;saving;saving acct&lt;BR /&gt;AS123456;transfers;transfer acct&lt;BR /&gt;AS123456;deposits;deposits acct&lt;BR /&gt;PT7891011;peti;peti acct&lt;BR /&gt;PT7891011;saving;saving acct&lt;BR /&gt;how to do it?</description>
      <pubDate>Sat, 07 Jan 2012 09:21:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362840#M126897</guid>
      <dc:creator>raj99</dc:creator>
      <dc:date>2012-01-07T09:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to replace null values with earlier row's values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362841#M126898</link>
      <description>Hi John &lt;BR /&gt;but your above code would only work for DB Tables which have nulls for files you may have to check if they are empty or not.</description>
      <pubDate>Sat, 07 Jan 2012 12:27:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362841#M126898</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-07T12:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to replace null values with earlier row's values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362842#M126899</link>
      <description>If you want to count the empty string ("") as null, there is an option in (most of) the input components to convert it to a java null. Otherwise, you can update the "if" statements to check for empty string: 
&lt;BR /&gt; 
&lt;PRE&gt;if(input_row.accountno != null) {&lt;/PRE&gt; 
&lt;BR /&gt;would become: 
&lt;BR /&gt; 
&lt;PRE&gt;if(input_row.accountno != null || !"".equals(input_row.accountno) ) {&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jan 2012 16:49:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362842#M126899</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-09T16:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to replace null values with earlier row's values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362843#M126900</link>
      <description>Correct...&lt;BR /&gt;i instead checked for its length if it is not 0.</description>
      <pubDate>Mon, 09 Jan 2012 17:00:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/how-to-replace-null-values-with-earlier-row-s-values/m-p/2362843#M126900</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-09T17:00:36Z</dc:date>
    </item>
  </channel>
</rss>

