Create loop, execute, then continue with main flow

One Star

Create loop, execute, then continue with main flow

Hi
Im trying to solve something like this :
In main flow I call webservice, got list of items, then I need to call webservice for each item I've received in a loop, find correct subitem (response from webservice in loop) and continue with main flow.
So basically in pseudocode I need this :
list = webserviceCallback();
foreach(item : list) {
   response = webserviceCallback(item);
   if(item == expectedResult) {
       result = item;
       break;
   } 
}
continue main flow ...

What is the best way to achieve this ?
I tried the subjob, but Im not sure how to pass input variable there and retrieve output.
Another posibility would be create some sort of 'subflow' in main job, but Im not sure how to do this either.
Any thought or suggestions are welcome...
One Star

Re: Create loop, execute, then continue with main flow

I found a solution - 
1. create subjob
2. you can send input variables using context - subjob can has his own variables, which are not visible to context of main job
3. Output can be done via context variable by passing something by reference (e.g. concurenthashmap) 

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

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

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

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