Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
JayQueue
Creator
Creator

Use variables from one output in another output after replicate

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:

  1. Changing the order
  2. I've been looking into subJobs but I can't seem to figure it out.
  3. tSetGlobalVar

Here's my job

0695b00000KAW16AAH.png

Labels (3)
1 Solution

Accepted Solutions
gjeremy1617088143

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

 

View solution in original post

18 Replies
gjeremy1617088143

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

JayQueue
Creator
Creator
Author

Hello @guenneguez jeremy​ 

 

I tried that but then the first row is NULL

 

This is the job:

0695b00000KAgpQAAT.png 

Changed the Main order behind the Replicate.

Did the mapping with tXMLMap_1

0695b00000KAgqnAAD.pngThen set the tSetGlobalVar_1:

0695b00000KAgrbAAD.png 

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

 

Anonymous
Not applicable

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

gjeremy1617088143

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

gjeremy1617088143

also when you try to get globalVar it's better to specify the type :

System.out.println((String)globalMap.get("_documentSubject"))

gjeremy1617088143

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.

JayQueue
Creator
Creator
Author

Hello @Shicong Hong​ ,

 

Thanks for the help.

But I can only choose On Component Ok

0695b00000KAhMoAAL.png

JayQueue
Creator
Creator
Author

Thanks @guenneguez jeremy​ , I found already 🙂

JayQueue
Creator
Creator
Author

I thought I was in an iteration

 

0695b00000KAhO6AAL.png