[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
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. 

All Replies
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.
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. 
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.

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now