[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

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
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!