[resolved] Filling columns in a database table from the current file name

Highlighted
One Star

[resolved] Filling columns in a database table from the current file name

I am using tfilelist to iterate through a list of files with a fixed name pattern "A_B_C_D_E.xlsx". I have some columns in my database table out of which 5 columns need to be filled with the values A, B, C, D and E. How can I do this?

Accepted Solutions
Highlighted
One Star

Re: [resolved] Filling columns in a database table from the current file name

Ma'am,
I have already figured a way around my problem. I was processing all the files in my folder which contained the files in a fixed format (5 attributes delimited by an underscore). I had to upload the files to a database table containing 42 columns, out of which 5 columns were to be filled by the delimited attributes in the current filename. I used 5 global context variables for the 5 attributes, and then, used "CURRENT_FILEPATH(Flow)" from the "tFileList" component. Using a "tjava" component to split the current filename and assign the attributes to their corresponding values, I then used the values of these attributes in the output of tMap. 
Thank you very much for the reply, anyway. 

View solution in original post


All Replies
Highlighted
Moderator

Re: [resolved] Filling columns in a database table from the current file name

Hi,
I have some columns in my database table out of which 5 columns need to be filled with the values A, B, C, D and E. How can I do this?

Could you please elaborate your case with an example with input and expected output values?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Highlighted
One Star

Re: [resolved] Filling columns in a database table from the current file name

Ma'am,
I have already figured a way around my problem. I was processing all the files in my folder which contained the files in a fixed format (5 attributes delimited by an underscore). I had to upload the files to a database table containing 42 columns, out of which 5 columns were to be filled by the delimited attributes in the current filename. I used 5 global context variables for the 5 attributes, and then, used "CURRENT_FILEPATH(Flow)" from the "tFileList" component. Using a "tjava" component to split the current filename and assign the attributes to their corresponding values, I then used the values of these attributes in the output of tMap. 
Thank you very much for the reply, anyway. 

View solution in original post

Highlighted
Moderator

Re: [resolved] Filling columns in a database table from the current file name

Hi,
Thanks for posting that you have resolved your issue and sharing your solution with us.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog