Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
Backstory: I'm coming from FME and started using Talend since 4th of October, without a course. So bear with me 😉
Issue:
I'm reading a folder where there are 2 files, an XML and a PDF. The XML contains the metadata from that PDF (both have the same name).
Now I'm uploading that PDF with a tFileFetch but I want to pass the metadata directly with that request. Is that even possible with my job?
What I tried:
Here's my job
also wich values will you stock in the pdf flow ?
cause if it's just filename so after you get the xml file metadata just check if the pdf exist (it's easy if they have the same file name) with a tFileExist and if it's ok filefetch with the values you got.
tFilelist -->iterate -->fileinput XML -->xmlMap--> tSetGlobalVar -->on component ok -->fileExist -->run if fileExist is true and globalvar from xml not null--> tfilefetch
Hi @JayQueue,
you can use TSetGlobalVar after the tXMLMAP_1 and change the order of the TReplicate row so the globalvar will be set before you use the tfile fetch
Send me love and kudos
Hello @guenneguez jeremy
I tried that but then the first row is NULL
This is the job:
Changed the Main order behind the Replicate.
Did the mapping with tXMLMap_1
Then set the tSetGlobalVar_1:
I added a tJavaRow in Main order:2 and Main order:1 with
System.out.println("Value of _documentSubject in Main Order:2");
System.out.println(globalMap.get("_documentSubject"));
My output is
Value of _documentSubject in Main Order:2
null
Value of _documentSubject in Main Order:1
Uitgaande facturen Kotee
Value of _documentSubject in Main Order:2
Uitgaande facturen Kotee
Value of _documentSubject in Main Order:1
Uitgaande facturen fin.dienst
So it's starting with Main Order:2!?
That looks weird.
Sending love and kudos
To make sure the job runs in order, i would suggest you to split the job into different subjobs, eg:
tFileList--tIterateToFlow--tHashOutput
|onsubjobok
tHashInput--main--XML file...
|onsubjobok
tHashInput--main--PDF file...
Regards
Shong
If you have difficulty to find hash component :
https://help.talend.com/r/iDUwyneSPUgZVyVcWpVlVw/v0SoaRheiWnba9aPAp21gQ
it's for 6.5 doc but it's the same for 7.3
also when you try to get globalVar it's better to specify the type :
System.out.println((String)globalMap.get("_documentSubject"))
and the gloabalvar can't work if it doesn't used in an iteration for all the flow, the problem here is you directly use iteratetoflow so you're no longer in an iteration.
Hello @Shicong Hong ,
Thanks for the help.
But I can only choose On Component Ok
Thanks @guenneguez jeremy , I found already 🙂
I thought I was in an iteration