<?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: TALEND - Keyword in a file in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/TALEND-Keyword-in-a-file/m-p/2359902#M124601</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;You can read the file content as a string using tFileInputRaw component, then check the string if it contains a keyword "body",&lt;/P&gt;&lt;P&gt;tFileInputRaw--tJavaRow--runIf1--action1&lt;/P&gt;&lt;P&gt;*******************************--runIf2​--action2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;on tJavaRow:&lt;/P&gt;&lt;P&gt;&lt;I&gt;if(input_row.content.toString().contains("body")){&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;globalMap.put("key",true);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;}else{&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;globalMap.put("key",false);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;}&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set the condition of runIf1 as:&lt;/P&gt;&lt;P&gt;(boolean)globalMap.get("key")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set the condition of runIf2 as:&lt;/P&gt;&lt;P&gt;!(boolean)globalMap.get("key")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when the key is true, action1 will be triggered, otherwise, action2 will be triggered. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shong&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Sep 2023 04:59:59 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-09-22T04:59:59Z</dc:date>
    <item>
      <title>TALEND - Keyword in a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/TALEND-Keyword-in-a-file/m-p/2359901#M124600</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;My problem seems very simple, but I've been stuck for a long time.&lt;/P&gt;&lt;P&gt;I need to read a file and check if it contains a keyword.&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;if in bob.txt there is the word "boby" -&amp;gt; action 1 otherwise action 2&lt;/P&gt;&lt;P&gt;It looks so simple.... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 21:24:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/TALEND-Keyword-in-a-file/m-p/2359901#M124600</guid>
      <dc:creator>Sil_B</dc:creator>
      <dc:date>2024-11-15T21:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: TALEND - Keyword in a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/TALEND-Keyword-in-a-file/m-p/2359902#M124601</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;You can read the file content as a string using tFileInputRaw component, then check the string if it contains a keyword "body",&lt;/P&gt;&lt;P&gt;tFileInputRaw--tJavaRow--runIf1--action1&lt;/P&gt;&lt;P&gt;*******************************--runIf2​--action2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;on tJavaRow:&lt;/P&gt;&lt;P&gt;&lt;I&gt;if(input_row.content.toString().contains("body")){&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;globalMap.put("key",true);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;}else{&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;globalMap.put("key",false);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;}&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set the condition of runIf1 as:&lt;/P&gt;&lt;P&gt;(boolean)globalMap.get("key")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set the condition of runIf2 as:&lt;/P&gt;&lt;P&gt;!(boolean)globalMap.get("key")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when the key is true, action1 will be triggered, otherwise, action2 will be triggered. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shong&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 04:59:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/TALEND-Keyword-in-a-file/m-p/2359902#M124601</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-09-22T04:59:59Z</dc:date>
    </item>
  </channel>
</rss>

