1

I'm a newbie here in Talend and what I am trying to do is to split different output file, here is an example of the file that I am working on...

File of Example

For example:

Whenever I see a column with a true value I need to produce different file of it including the row with the value of true.

So the output should be like this: output example

output example output example

Thanks in advance guys, hope someone could help me.

nel
  • 13
  • 2

2 Answers2

0

I would try this :

tFileInputExcel -> main -> tReplicate -> main -> tFilterRow (quoteName equals quote1 ) -> tlog

                                   -> main -> tFilterRow (quoteName equals 
                                   quote2 
                                             ) -> tlog 
                                  -> main -> tFilterRow (quoteName equals quote3 
                                             ) -> tlog 
                                  -> main -> tFilterRow (quoteName equals quote4 
                                             ) -> tlog 

Or using a tMap component would do the staff using filtering optin in the output

0

Here is a dynamic solution. Your input file should be sorted on "quoteName"

enter image description here

  1. tFileInput : read your file
  2. tFilterRow : filter on isLastItem : only "true" value (so you'll get only one row for each quoteName)
  3. tflowToIterate : convert your flow into an iteration : you'll have n iterations created (n being the number of distinct quoteNames).
  4. tFileInput : re-read your entire file in your current Iteration
  5. tFilterRow : filter on quote=((String)globalMap.get("row2.quote")) (with row2.quote being the value of your globalVariable created by tFlowToIterate)
  6. tFileOutput : output file. You can put something like : "C:/Temp/"+((String)globalMap.get("row3.quote"))+".txt" in order to generate your distinct files.

Use "Outline" view to get access to global variables created by tFlowToIterate.

Corentin
  • 2,442
  • 1
  • 17
  • 28