Create floders based on column values

Seven Stars

Create floders based on column values

Hi Team,


I have below scenario.


Source : Oracle/File

Target: File/Oracle


Source Columns


snlno, txn_dt

1, 2017-01-07





Required output:






I want store all distinct dates in context variable and use to create folder based on dates, store records inside directory only specific to that date.




Sixteen Stars

Re: Create floders based on column values

There are a couple of things to think about here. First of all, you will need to be able to use a bit of Java to manipulate your date information to get the required String to build your folder path. Take a look here:

The above should give you an idea of how to achieve this using Talend system routines.


The next bit to consider is a little bit more complicated. You can create your folder when you create a file that needs to be written in that folder. That is easy enough. SO you will not have to worry about preemptively creating your folder and then writing your file there. But it looks like you will need to keep changing the file you are writing to in a single flow.....which does not work out of the box. You will need to group your data by output file and iterate over that group so that your file is created and written to in separate flows......which is a pain.


Or (if you are not scared of a little Java) you can follow what I have done in this tutorial....


Seven Stars

Re: Create floders based on column values



Thanks for valuable input.


I am not good in java, Let me go though as suggested inputs.