[resolved] Multiple Rows to single row (on lookup)

One Star

[resolved] Multiple Rows to single row (on lookup)

is there any additional component to achieve this?
mySqlInput--------------->tMap ----------------------------------> tJavaFlex ---------------------------> tWebservice
^ (puts each item in a List) (parameter: List)
| (lookup, join all matches)
|
mySqlInput
when i try to set onComponent ok connection between tjavaflex an webservice, the request only happens for the last main row. When doing normal main connention, each lookup row gets passed to twebservice (not the complete List) Is there any component that passes the output row on condition (only when the list is filled)?

Accepted Solutions
Community Manager

Re: [resolved] Multiple Rows to single row (on lookup)

Hi
In the begining part of tJavaFlex: define a list, eg:
java.util.List list=new java.util.ArrayList();
In the main part of tJavaFlex: add each row to the list, eg:
list.add(row1.columnName);
In the end part of tJavaFlex: put the list to a global variable for use later, eg:
globalMap.put("mylist",list);
in the next subjob, get the list and pass it to tWebservice, the job design looks like:
mySqlInput--------------->tMap ----------------------------------> tJavaFlex
^ (puts each item in a List)
| (lookup, join all matches)
|
mySqlInput
|
onsubjobok
|
tFixedFlowInput--main--tWebservice
on tFixedFlowInput, generate one data flow with one column, let's call it mylist, object type.
key:value
mylistSmiley Sad(java.util.Array)globalMap.get("mylist")
----------------------------------------------------------
Talend | Data Agility for Modern Business

View solution in original post


All Replies
Community Manager

Re: [resolved] Multiple Rows to single row (on lookup)

Hi
In the begining part of tJavaFlex: define a list, eg:
java.util.List list=new java.util.ArrayList();
In the main part of tJavaFlex: add each row to the list, eg:
list.add(row1.columnName);
In the end part of tJavaFlex: put the list to a global variable for use later, eg:
globalMap.put("mylist",list);
in the next subjob, get the list and pass it to tWebservice, the job design looks like:
mySqlInput--------------->tMap ----------------------------------> tJavaFlex
^ (puts each item in a List)
| (lookup, join all matches)
|
mySqlInput
|
onsubjobok
|
tFixedFlowInput--main--tWebservice
on tFixedFlowInput, generate one data flow with one column, let's call it mylist, object type.
key:value
mylistSmiley Sad(java.util.Array)globalMap.get("mylist")
----------------------------------------------------------
Talend | Data Agility for Modern Business

View solution in original post

One Star

Re: [resolved] Multiple Rows to single row (on lookup)

Try a tFlowToIterate before the WebService. No guarantees.
One Star

Re: [resolved] Multiple Rows to single row (on lookup)

Hi
In the begining part of tJavaFlex: define a list, eg:
java.util.List list=new java.util.ArrayList();
In the main part of tJavaFlex: add each row to the list, eg:
list.add(row1.columnName);
In the end part of tJavaFlex: put the list to a global variable for use later, eg:
globalMap.put("mylist",list);
in the next subjob, get the list and pass it to tWebservice, the job design looks like:
mySqlInput--------------->tMap ----------------------------------> tJavaFlex
^ (puts each item in a List)
| (lookup, join all matches)
|
mySqlInput
|
onsubjobok
|
tFixedFlowInput--main--tWebservice
on tFixedFlowInput, generate one data flow with one column, let's call it mylist, object type.
key:value
mylistSmiley Sad(java.util.Array)globalMap.get("mylist")

shong! talend master! awsome! works as it should, thanks!

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 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog