<?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: [resolved] compare string with a list in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-compare-string-with-a-list/m-p/2231970#M22088</link>
    <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;Hi &lt;BR /&gt;There is no a specialized component to do this, the solution is to read each line from File A, and then iterate each line from File B, and write a piece of Java code remove the same string from File A, the job is showed in my screenshot.&lt;BR /&gt;on tJava_1, put the current record from A to a global variable. &lt;BR /&gt;&lt;PRE&gt;globalMap.put("result",row1.a);&lt;/PRE&gt;&lt;BR /&gt;on tJava: write a piece of Java code to check if the string from A contains the same substring in B, and remove the substring, for example:&lt;BR /&gt;&lt;PRE&gt;int substring_index=0;&lt;BR /&gt;String result=(String)globalMap.get("result");&lt;BR /&gt;String b=(String)globalMap.get("row2.b");&lt;BR /&gt;if(result.contains(b)){&lt;BR /&gt;substring_index=result.indexOf(row2.b);&lt;BR /&gt;globalMap.put("result",result.substring(0,substring_index)+result.substring(substring_index+b.length()));&lt;BR /&gt;}&lt;/PRE&gt;&lt;BR /&gt;on tFixedFlowInput_3, output the end result after all iteration on records from B.&lt;BR /&gt;result:&lt;BR /&gt;&lt;PRE&gt;Starting job ddf at 13:52 18/11/2013.&lt;BR /&gt;&lt;BR /&gt; connecting to socket on port 4026&lt;BR /&gt; connected&lt;BR /&gt;day&lt;BR /&gt;lucky&lt;BR /&gt;writeyour&lt;BR /&gt; disconnected&lt;BR /&gt;Job ddf ended at 13:52 18/11/2013. &lt;/PRE&gt;&lt;BR /&gt;Shong&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Millions of thanks 
&lt;BR /&gt;You are the best Shong!</description>
    <pubDate>Tue, 19 Nov 2013 00:31:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-11-19T00:31:05Z</dc:date>
    <item>
      <title>[resolved] compare string with a list</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-compare-string-with-a-list/m-p/2231968#M22086</link>
      <description>Hi Everyone&lt;BR /&gt;I wanna read string from a CSV file(A) one by one.&lt;BR /&gt;And compare each string with string list(CSV B). &lt;BR /&gt;If string from A contains the same substring in B, then exclude the substring from A and output.&lt;BR /&gt;Ex:&lt;BR /&gt;A File&lt;BR /&gt;---------------------&lt;BR /&gt;oneniceday&lt;BR /&gt;luckydog&lt;BR /&gt;writeyourmessage&lt;BR /&gt;---------------------&lt;BR /&gt;B File&lt;BR /&gt;---------------------&lt;BR /&gt;one&lt;BR /&gt;nice&lt;BR /&gt;dog&lt;BR /&gt;message&lt;BR /&gt;---------------------&lt;BR /&gt;Processing:&lt;BR /&gt;---------------------&lt;BR /&gt;oneniceday --&amp;gt; exclude 'one' 'nice' --&amp;gt; day&lt;BR /&gt;luckydog  --&amp;gt; exlude 'dog' --&amp;gt; lucky&lt;BR /&gt;writeyourmessage   --&amp;gt; exlude 'message' --&amp;gt; writeyour&lt;BR /&gt;---------------------&lt;BR /&gt;result:&lt;BR /&gt;---------------------&lt;BR /&gt;day&lt;BR /&gt;lucky&lt;BR /&gt;writeyour&lt;BR /&gt;---------------------&lt;BR /&gt;Is there any suggestion, idea or component to implement?&lt;BR /&gt;Appreciated!</description>
      <pubDate>Sat, 16 Nov 2024 11:50:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-compare-string-with-a-list/m-p/2231968#M22086</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T11:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] compare string with a list</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-compare-string-with-a-list/m-p/2231969#M22087</link>
      <description>Hi 
&lt;BR /&gt;There is no a specialized component to do this, the solution is to read each line from File A, and then iterate each line from File B, and write a piece of Java code remove the same string from File A, the job is showed in my screenshot. 
&lt;BR /&gt;on tJava_1, put the current record from A to a global variable. 
&lt;BR /&gt; 
&lt;PRE&gt;globalMap.put("result",row1.a);&lt;/PRE&gt; 
&lt;BR /&gt;on tJava: write a piece of Java code to check if the string from A contains the same substring in B, and remove the substring, for example: 
&lt;BR /&gt; 
&lt;PRE&gt;int substring_index=0;&lt;BR /&gt;String result=(String)globalMap.get("result");&lt;BR /&gt;String b=(String)globalMap.get("row2.b");&lt;BR /&gt;if(result.contains(b)){&lt;BR /&gt;substring_index=result.indexOf(row2.b);&lt;BR /&gt;globalMap.put("result",result.substring(0,substring_index)+result.substring(substring_index+b.length()));&lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;on tFixedFlowInput_3, output the end result after all iteration on records from B. 
&lt;BR /&gt;result: 
&lt;BR /&gt; 
&lt;PRE&gt;Starting job ddf at 13:52 18/11/2013.&lt;BR /&gt;&lt;BR /&gt; connecting to socket on port 4026&lt;BR /&gt; connected&lt;BR /&gt;day&lt;BR /&gt;lucky&lt;BR /&gt;writeyour&lt;BR /&gt; disconnected&lt;BR /&gt;Job ddf ended at 13:52 18/11/2013. &lt;/PRE&gt; 
&lt;BR /&gt;Shong 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBba.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/137152i34609419D74FCF5C/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBba.png" alt="0683p000009MBba.png" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBk7.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/142876iD562AFFD3431DDB5/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBk7.png" alt="0683p000009MBk7.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Mon, 18 Nov 2013 05:47:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-compare-string-with-a-list/m-p/2231969#M22087</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-11-18T05:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] compare string with a list</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-compare-string-with-a-list/m-p/2231970#M22088</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;Hi &lt;BR /&gt;There is no a specialized component to do this, the solution is to read each line from File A, and then iterate each line from File B, and write a piece of Java code remove the same string from File A, the job is showed in my screenshot.&lt;BR /&gt;on tJava_1, put the current record from A to a global variable. &lt;BR /&gt;&lt;PRE&gt;globalMap.put("result",row1.a);&lt;/PRE&gt;&lt;BR /&gt;on tJava: write a piece of Java code to check if the string from A contains the same substring in B, and remove the substring, for example:&lt;BR /&gt;&lt;PRE&gt;int substring_index=0;&lt;BR /&gt;String result=(String)globalMap.get("result");&lt;BR /&gt;String b=(String)globalMap.get("row2.b");&lt;BR /&gt;if(result.contains(b)){&lt;BR /&gt;substring_index=result.indexOf(row2.b);&lt;BR /&gt;globalMap.put("result",result.substring(0,substring_index)+result.substring(substring_index+b.length()));&lt;BR /&gt;}&lt;/PRE&gt;&lt;BR /&gt;on tFixedFlowInput_3, output the end result after all iteration on records from B.&lt;BR /&gt;result:&lt;BR /&gt;&lt;PRE&gt;Starting job ddf at 13:52 18/11/2013.&lt;BR /&gt;&lt;BR /&gt; connecting to socket on port 4026&lt;BR /&gt; connected&lt;BR /&gt;day&lt;BR /&gt;lucky&lt;BR /&gt;writeyour&lt;BR /&gt; disconnected&lt;BR /&gt;Job ddf ended at 13:52 18/11/2013. &lt;/PRE&gt;&lt;BR /&gt;Shong&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Millions of thanks 
&lt;BR /&gt;You are the best Shong!</description>
      <pubDate>Tue, 19 Nov 2013 00:31:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-compare-string-with-a-list/m-p/2231970#M22088</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-11-19T00:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] compare string with a list</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-compare-string-with-a-list/m-p/2231971#M22089</link>
      <description>Hi,&lt;BR /&gt;Could you explain the last 3 steps in the code above&lt;BR /&gt;started with &lt;BR /&gt;if(result.contains(b))&lt;BR /&gt;Thanks in advance.</description>
      <pubDate>Fri, 06 May 2016 11:33:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-compare-string-with-a-list/m-p/2231971#M22089</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-06T11:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] compare string with a list</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-compare-string-with-a-list/m-p/2231972#M22090</link>
      <description>Hi Shong, 
&lt;BR /&gt; 
&lt;BR /&gt;Why can't we use the tmap and exp filter within that? 
&lt;BR /&gt;Actually i have the similar requirement but when i do that i don't get the exact out put. 
&lt;BR /&gt;1&amp;gt; file A has the main data 
&lt;BR /&gt;2&amp;gt;File B has the list of IDs which if present in the File A has to be removed 
&lt;BR /&gt;3&amp;gt; i used the regular tmap and the used the !contains(b) 
&lt;BR /&gt;Result: 
&lt;BR /&gt;Lets say 5 in file A and 4 in file B, and suppose all 4 have matching in B 
&lt;BR /&gt;Expected output: 1 
&lt;BR /&gt;Actual out i am getting: 
&lt;BR /&gt;(5*4) =20 -1 =19 and 1 goes to reject row 
&lt;BR /&gt;so its like whatever i dont want goes 1 single file but waht ever i want + what i dont want goes to other file, i have tried all setting but this work more or less same way.. 
&lt;BR /&gt; 
&lt;BR /&gt;Any help will be app!!</description>
      <pubDate>Thu, 06 Dec 2018 00:09:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-compare-string-with-a-list/m-p/2231972#M22090</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-06T00:09:28Z</dc:date>
    </item>
  </channel>
</rss>

