'Any solutions on splitting output file?
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...
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
Thanks in advance guys, hope someone could help me.
Solution 1:[1]
Here is a dynamic solution. Your input file should be sorted on "quoteName"
- tFileInput : read your file
- tFilterRow : filter on isLastItem : only "true" value (so you'll get only one row for each quoteName)
- tflowToIterate : convert your flow into an iteration : you'll have n iterations created (n being the number of distinct quoteNames).
- tFileInput : re-read your entire file in your current Iteration
- tFilterRow : filter on quote=((String)globalMap.get("row2.quote")) (with row2.quote being the value of your globalVariable created by tFlowToIterate)
- 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.
Solution 2:[2]
Try simply run this in the terminal:
python folder_path\code\cmd_line.py test
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Corentin |
| Solution 2 | Herivelton Andreassa |

