Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Dynamically add new column to my file.

Hi Community, 

I'am facing a problem in the design of a new job.

My input file structure is : 

Product Price

I have too many files as input each file refer to one month. The price is not fixed , it change from month to month what i am asked to do is to create 1 file with this schema

Product       FileName1          FileName2            FileName3 . . . 

Product 1    PriceintheFile1  PriceintheFile2     PriceintheFile3 ...

Product 2    PriceintheFile1  PriceintheFile2     PriceintheFile3 ...

etc

The File Name is the date of each month by the way.

what i have dont so far is : 

TfileList=>TFileInputDelimited=>Tmap=>TFileInputDelimited

in the Tmap i coudnt make the column's name dynamic.

Is this can be done with Talend ?

Thanks a lot for your time.

 

 

 

Labels (3)
1 Solution

Accepted Solutions
tnewbie
Creator II
Creator II

Hi Rami,

 

This is a very interesting scenario and I guess you may have to approach the issue as below:

Step :1

Push your output to a file where you include the filepath as one of the columns (like below)

file_path,prod_code,prod_price
C:\filepath\month_jan.txt,1001,100
C:\filepath\month_jan.txt,1002,105
C:\filepath\month_feb.txt,1001,100
C:\filepath\month_feb.txt,1002,105

Step :2

Use a component tUnpivotRow (you can find this component on Talend Exchange for free) this helps you convert your rows in to columns

 

I think this may solve your issue...good luck

View solution in original post

2 Replies
tnewbie
Creator II
Creator II

Hi Rami,

 

This is a very interesting scenario and I guess you may have to approach the issue as below:

Step :1

Push your output to a file where you include the filepath as one of the columns (like below)

file_path,prod_code,prod_price
C:\filepath\month_jan.txt,1001,100
C:\filepath\month_jan.txt,1002,105
C:\filepath\month_feb.txt,1001,100
C:\filepath\month_feb.txt,1002,105

Step :2

Use a component tUnpivotRow (you can find this component on Talend Exchange for free) this helps you convert your rows in to columns

 

I think this may solve your issue...good luck

Anonymous
Not applicable
Author

Thank you so much for your help.