<?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: Split a file with Talend ESB in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Split-a-file-with-Talend-ESB/m-p/2347435#M114693</link>
    <description>There are a few ways you could do this. &amp;nbsp;First, please explain what you mean when you say cFilter does not work. &amp;nbsp;Could you share a screenshot showing how you are trying to use it? 
&lt;BR /&gt;So if you know in advance that there are a fixed number of alternatives then you can use a content based router. &amp;nbsp;For example, if you know the only record types you will receive are "1855" and "1856" then you can extract them from the input message, put them into a message header, and then route based on the header. 
&lt;BR /&gt;You would use the following Talend components: 
&lt;BR /&gt;cFile --&amp;gt; cSetHeader --&amp;gt; cMessageRouter --&amp;gt; &amp;nbsp;(the rest of your route) 
&lt;BR /&gt;Note that cMessageRouter can take multiple outputs. &amp;nbsp;You want to use the "When" path for most of your distinct routes. 
&lt;BR /&gt;An alternative approach would be to use cMulticast along with cFilter. &amp;nbsp;It has the "advantage" of potentially being multi-threaded and it will still preserve rel ative order. 
&lt;BR /&gt;If the number of output alternatives is unknown (e.g. put all messages into distinct files based on the value in the second column, then use cSetHeader to set the CamelFileName header. &amp;nbsp;CamelFileName is a special header for the cFile component. &amp;nbsp;You will also need to set the fileExist option on the cFile output component. &amp;nbsp;(Note that this is the output, not the input cFile). 
&lt;BR /&gt;You may want to check the performance if you use the cFile approach. &amp;nbsp;I am not sure how cFile caches its output file handles and if it will do this efficiently. &amp;nbsp;I think it will, but verify.</description>
    <pubDate>Mon, 01 Aug 2016 15:01:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-08-01T15:01:32Z</dc:date>
    <item>
      <title>Split a file with Talend ESB</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Split-a-file-with-Talend-ESB/m-p/2347432#M114690</link>
      <description>Hello everybody,&lt;BR /&gt;I am new to the forum&lt;BR /&gt;I use Talend ESB and I have a question.&lt;BR /&gt;I have this flat file:&lt;BR /&gt;11886 1855 0000004309000&lt;BR /&gt;11886 1855 0000057370000&lt;BR /&gt;11886 1856 0000057374001 &amp;nbsp; &amp;nbsp;&lt;BR /&gt;11886 1856 0000057375000 &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;And i want 2 files (messages), a filter of "1855" and "1856":&lt;BR /&gt;11886 1855 0000004309000&lt;BR /&gt;11886 1855 0000057370000&lt;BR /&gt;And:&lt;BR /&gt;11886 1856 0000057374001 &amp;nbsp; &amp;nbsp;&lt;BR /&gt;11886 1856 0000057375000 &amp;nbsp;&lt;BR /&gt;I tested the cfilter but i doesn't work.&lt;BR /&gt;Do you have any idea ?&lt;BR /&gt;Thank you in advance.&lt;BR /&gt;Natacha.</description>
      <pubDate>Sat, 16 Nov 2024 10:28:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Split-a-file-with-Talend-ESB/m-p/2347432#M114690</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T10:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Split a file with Talend ESB</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Split-a-file-with-Talend-ESB/m-p/2347433#M114691</link>
      <description>Hi,
&lt;BR /&gt;Have you already checked tMap component in DI perspective and set an expression for&amp;nbsp;
&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;a filter of "1855" and "1856"?&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;BR /&gt;
&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;Best regards&lt;/FONT&gt;&lt;/FONT&gt;
&lt;BR /&gt;
&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;Sabrina&lt;/FONT&gt;&lt;/FONT&gt;</description>
      <pubDate>Mon, 01 Aug 2016 05:04:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Split-a-file-with-Talend-ESB/m-p/2347433#M114691</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-01T05:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Split a file with Talend ESB</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Split-a-file-with-Talend-ESB/m-p/2347434#M114692</link>
      <description>&lt;BLOCKQUOTE&gt;
 &lt;TABLE border="1"&gt;
  &lt;TBODY&gt;
   &lt;TR&gt;
    &lt;TD&gt;Hi,&lt;BR /&gt;Have you already checked tMap component in DI perspective and set an expression for&amp;nbsp;&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;a filter of "1855" and "1856"?&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;Best regards&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1"&gt;&lt;FONT face="Verdana, Helvetica, Arial, sans-serif"&gt;Sabrina&lt;/FONT&gt;&lt;/FONT&gt;&lt;/TD&gt;
   &lt;/TR&gt;
  &lt;/TBODY&gt;
 &lt;/TABLE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;BR /&gt;Thanks for you answer Sabrina !
&lt;BR /&gt;I am in Talend Mediation, there is no Tmap.</description>
      <pubDate>Mon, 01 Aug 2016 14:24:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Split-a-file-with-Talend-ESB/m-p/2347434#M114692</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-01T14:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Split a file with Talend ESB</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Split-a-file-with-Talend-ESB/m-p/2347435#M114693</link>
      <description>There are a few ways you could do this. &amp;nbsp;First, please explain what you mean when you say cFilter does not work. &amp;nbsp;Could you share a screenshot showing how you are trying to use it? 
&lt;BR /&gt;So if you know in advance that there are a fixed number of alternatives then you can use a content based router. &amp;nbsp;For example, if you know the only record types you will receive are "1855" and "1856" then you can extract them from the input message, put them into a message header, and then route based on the header. 
&lt;BR /&gt;You would use the following Talend components: 
&lt;BR /&gt;cFile --&amp;gt; cSetHeader --&amp;gt; cMessageRouter --&amp;gt; &amp;nbsp;(the rest of your route) 
&lt;BR /&gt;Note that cMessageRouter can take multiple outputs. &amp;nbsp;You want to use the "When" path for most of your distinct routes. 
&lt;BR /&gt;An alternative approach would be to use cMulticast along with cFilter. &amp;nbsp;It has the "advantage" of potentially being multi-threaded and it will still preserve rel ative order. 
&lt;BR /&gt;If the number of output alternatives is unknown (e.g. put all messages into distinct files based on the value in the second column, then use cSetHeader to set the CamelFileName header. &amp;nbsp;CamelFileName is a special header for the cFile component. &amp;nbsp;You will also need to set the fileExist option on the cFile output component. &amp;nbsp;(Note that this is the output, not the input cFile). 
&lt;BR /&gt;You may want to check the performance if you use the cFile approach. &amp;nbsp;I am not sure how cFile caches its output file handles and if it will do this efficiently. &amp;nbsp;I think it will, but verify.</description>
      <pubDate>Mon, 01 Aug 2016 15:01:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Split-a-file-with-Talend-ESB/m-p/2347435#M114693</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-01T15:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Split a file with Talend ESB</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Split-a-file-with-Talend-ESB/m-p/2347436#M114694</link>
      <description>Indeed, the number of outputs is unknown (my two files are an example).&amp;nbsp;I have a number of unknown orders.
&lt;BR /&gt;But I don't know how to extract the order number in the file in the cSetHeader. How to extract the order according to the positional?
&lt;BR /&gt;This is a flat file.
&lt;BR /&gt;Thank you in advance.</description>
      <pubDate>Mon, 01 Aug 2016 16:22:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Split-a-file-with-Talend-ESB/m-p/2347436#M114694</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-01T16:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: Split a file with Talend ESB</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Split-a-file-with-Talend-ESB/m-p/2347437#M114695</link>
      <description>Natacha, you can solve the problem by using the following route: 
&lt;BR /&gt; 
&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/300862/blob_20160829-1233.png" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBEu.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/151604i6F01D513F7F92024/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBEu.png" alt="0683p000009MBEu.png" /&gt;&lt;/span&gt; &lt;/A&gt; 
&lt;BR /&gt;It is based on a fixed Length bindy unmarshaling and a simple Splitter that generates a bean instance for each file record; then, the cSetHeader component creates a new header property ( here called "group" ) using the second column value; finally you can find the cFile ( output FixedFiles ) with&amp;nbsp;"fixedOut-${header.group}.txt"; so one file per group value is automatically generated ( with the cFile output component the advance setting "fileExist"-&amp;gt;"append" is configured to insert records into the corresponding file. 
&lt;BR /&gt;I ran it using your pasted data geting the following two files: 
&lt;BR /&gt;fixedOut-1855.txt 
&lt;BR /&gt;11886 1855 0000004309000 
&lt;BR /&gt;11886 1855 0000057370000 
&lt;BR /&gt;fixedOut-1856.txt 
&lt;BR /&gt;11886 1856 0000057374001 
&lt;BR /&gt;11886 1856 0000057375000 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;BR /&gt;Hope this helps, please let me know if you need assitance on getting the unmarshaling works. 
&lt;BR /&gt;Esteban.</description>
      <pubDate>Mon, 29 Aug 2016 20:35:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Split-a-file-with-Talend-ESB/m-p/2347437#M114695</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-08-29T20:35:22Z</dc:date>
    </item>
  </channel>
</rss>

