Naming the output based on a column value in Talend

0 votes

have a job in which I am using Database input component, tMap for processing and Excel output component to store the data. Now, I need to name this output file based on one of the values from the database table. To be more specific, I need to fetch the values from the column named “TYPE” with value “A1”. 

Please enlighten me how to perform this Job.

Apr 19, 2018 in Talend by v.liyyah
• 1,300 points
2,603 views

1 answer to this question.

0 votes

You can try to solve this problem by adding few more components to your job like tMysqlInput and a tSetGlobalVar component and setting up your job as shown:

image

Once done, go to the component tab of tMysqlInput_1 type the given query:

select TYPE from my_table limit 1;

In the tSetGlobalVar component, specify the key-value pair:

key = "file_name", value = (String)row1.type

Now, go to the tMysqlInput_1 and specify the input table and proceed to map the data.

In the “File Name” field of the tFileOutputExcel, specify the below expression to name it based on the output:

"C:\\Users\\XYZ\\"+((String)globalMap.get("file_name"))”

Note that this is not the only solution. There are n number of ways to achieve the same result. But among all, I feel this is the easiest one. Hope this helps!!

To know more about Talend, join Talend for big data certification training today.

Thanks.

answered Apr 19, 2018 by 93.lynn
• 1,600 points

Related Questions In Talend

0 votes
2 answers
0 votes
1 answer

Specifying the number of Rows Processed in Talend

Hi, you can try using tSampleRow component ...READ MORE

answered Apr 14, 2018 in Talend by code.reaper12
• 3,500 points
1,861 views
0 votes
1 answer

Creating a New Project in Talend Open Studio

Before you switch over to a new ...READ MORE

answered Apr 18, 2018 in Talend by misc.edu04
• 1,450 points
2,086 views
0 votes
1 answer

How to generate multiple rows from a single row in Talend?

I think using tJavaFlex, tMap and tFlowToIterate ...READ MORE

answered Apr 18, 2018 in Talend by code.reaper12
• 3,500 points
7,848 views
0 votes
1 answer
0 votes
1 answer

Looping through all the schemas in Talend

It is really simple to make tOracleInput ...READ MORE

answered Apr 11, 2018 in Talend by code.reaper12
• 3,500 points
1,908 views
0 votes
1 answer

Adding third party libraries into the Talend project

You can add the 3rd party libraries ...READ MORE

answered Apr 9, 2018 in Talend by code.reaper12
• 3,500 points
3,992 views
0 votes
1 answer

tWaitForFile component insufficiency in Talend

Regarding your first issue, tWaitForFile component provides ...READ MORE

answered Apr 11, 2018 in Talend by geek.erkami
• 2,680 points
2,516 views
0 votes
1 answer

Downloading files using Talend Studio

As per my understanding, I think first ...READ MORE

answered Apr 12, 2018 in Talend by code.reaper12
• 3,500 points
2,438 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP