Issue in creating dynamic filename in tAdvancedFileOutputXML

One Star

Issue in creating dynamic filename in tAdvancedFileOutputXML

I am facing an issue in retrieving a value from tMap component output, using which I want to create many XML files.

While searching in forums, I tried to use a solution and was able to create many XMLs (dynamic filenames) but I lost one of the values in that job.
Following is the flow of my job:

tMysqlInput -> tMap -> tFlowToIterate -> tRowGenerator -> tAdvancedFileOutputXML

I have two use two parameters which are obtained using tMap:
title: 2010_HY_webcast
location : /Channels/GHQ/content/Investor_Relations/Download_Center/

Following is the FileName, I have given in tAdvancedFileOutputXML:

context.ROOTDIR + row2.location + "/.content.xml"

So, location is used in creating dynamic filename and the .content.xml contains a title parameter, which should have value of title from tMap component. But, this value is lost in between the iteration and the title value in .content.xml is the last value being retrieved in tFlowToIterate.

Let me know if someone has any thoughts on the same.

Thanks
Dipti

PS: Attached are the required snapshots
One Star

Re: Issue in creating dynamic filename in tAdvancedFileOutputXML

Anyone has any point of view on the same?

Thanks
Dipti
One Star

Re: Issue in creating dynamic filename in tAdvancedFileOutputXML

Hello,

This morning, I do a job where the name of my xml files are the facture number.
But i do 2 jobs for that.

In the first job i list a directory, i take the files's properties , and after in a tJavaRow i initialise variable context:
context.setProperty("md5", row1.md5==null? "" : row1.md5);
context.setProperty("nom_pdf", row1.basename==null? "" : row1.basename);
context.setProperty("repertoire", row1.dirname==null? "" : row1.dirname);

After the tJavaRow, there is a tRunJob.
Picture :Job1_facture_vente_0.1.png




In the second job, i read the file , in a tMap , i mapp my data and in exit i have tAdvancedFileOutputXML where i whrite in name:
"C:/Bureau/xml/" + context.nom_pdf.replace(".PDF",".xml")

where context.nom_pdf is a variable in my context.
Picture :Job2_facture_vente_0.1.png
Six Stars

Re: Issue in creating dynamic filename in tAdvancedFileOutputXML

Dipti wrote:
Anyone has any point of view on the same?

Thanks
Dipti

Do you use the values exported by tflowtoiterate? (ctrl+space to access them)
One Star

Re: Issue in creating dynamic filename in tAdvancedFileOutputXML

Thanks for you reply. I retrieved the values using globalMap variable.
For eg: (String)globalMap.get("title")

Which is same as using tFlowToIterate and pressing control + space to get the value of variables defined in the component.

Regards
Dipti
Six Stars

Re: Issue in creating dynamic filename in tAdvancedFileOutputXML

Your design is not very clear without having a source data example and desidered output... anyway If you want to persist a value passed through the tmap you can push it to a context variable or use an inline tmemorizerow...

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Have you checked out Talend’s 2019 Summer release yet?

Find out about Talend's 2019 Summer release

Blog

Talend Summer 2019 – What’s New?

Talend continues to revolutionize how businesses leverage speed and manage scale

Watch Now

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