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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Passing data flow to a subjob

Hi,
I have a main job where i split according some conditions (trough a tmap) my flow into 2 flows and each of the flow should be processed by a subjob. How can i perform this action ? is it possible to pass a flow(not context) to a subjob ?
thank you for the answer
Best regards
Labels (2)
18 Replies
Anonymous
Not applicable
Author

I just wanted to add that i don't want to dump data into temp file.  i want to it on the flow, using for example buffers ...
Anonymous
Not applicable
Author

Try the tHashInput and tHashOutput components. They are perfect for this. If you can't find them in your Studio, this website shows you how to find them.
Anonymous
Not applicable
Author

Thank you rhall,
I tough that thashXXX components must be used withing the same job.
My goal is to pass a flow from a parent job to a subjob, if possible with the thashXXX, please can you give me more details on how to use it in this case ?
B Regards
Anonymous
Not applicable
Author

hi,
it's not a good solution for me but you can use context parameter (with componenet flowToIterate that put your data in globalMap)
Create a context group with the schema of your flow. Drag&drop it in child job & father job and pass each globalMap variable throught context parameter of the tRunJob.
tBuffer(output) is only from child job to father job.
a better solution is to store data in a file or mysql (myIsam engine) where I/O access are quick.
hope it helps
regards
laurent
Anonymous
Not applicable
Author

thank you Kzone,
But how do i get the values from the globalmap and translate them in a flow  in the CHILD JOB ?
Regards
Anonymous
Not applicable
Author

I think I misunderstood your question sofbar. I thought you were talking about passing between subjobs (ie the sections within a job that are grouped together). If you want to pass a dataset to a child job, then it may take a bit of Java coding....but it can be done.
What kzone described is a good solution for this. An example of how to do this would be to get your data into an ArrayList using a tJavaRow or tJavaFlex component. Create a context variable of type Object. If you don't program in Java, the Object class is the base class for all classes, therefore any object can be passed as an Object. Assign your ArrayList values to the Object context. Pass this context to your child job. Then in the child job, use a tJavaFlex to cast (change the type) the Object context to an ArrayList, then you can get your values from that. 
As kzone said, writing to another area would be better, but I can see why you might want to supply a small dataset like this at runtime without writing elsewhere.
Anonymous
Not applicable
Author

thank you for your reply rhall.
I am a beginner in java, can you please give the code for:
1) Assign your ArrayList values to the Object context
2) use a tJavaFlex to cast (change the type) the Object context to an ArrayList, then you can get your values from that.
thank you for your help
Regards
Anonymous
Not applicable
Author

Here are a couple of examples.....
1) After you have populated your ArrayList ( http://java.about.com/od/javautil/a/Using-The-Arraylist.htm), simply save it to the context variable you have created as type Object....
context.myObjectContext = myArrayList;
2) I have an example of using an ArrayList with a tJavaFlex component here. The tutorial is about doing something else with Talend, but about 2/3 of the way down I have written a small bit on how the tJavaFlex is used in the example. This should give you an insight
To cast from an Object to an ArrayList you simply do the following.....
ArrayList myCastArrayList = (ArrayList)context.myObjectContext
Hope this helps
Regards
Richard
Anonymous
Not applicable
Author

you can  also use the context params (no java to code 0683p000009MACn.png
see screenshoots
0683p000009MDEW.png 0683p000009MCdx.png 0683p000009MBn0.png
in the tRunJob I 've written each attriute coming from the flow (row1) in the definition of my context parameters.
in childJob I declare my context containing all my attribute & use a fixed flow component to (re)initialize my flow => logrow
Use tRowGenerator to generate data on the fly ...
result :
 
0683p000009MDEb.png
hope it helps
regards
laurent