
Anonymous
Not applicable
2015-02-05
09:50 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Iterate over java array list and update database
Hi,
I have a scenario where I need to iterate over java arraylist and then I need to update database table for each entry in the arraylist. Fore each record I need to lookup other tables as well. Therefore the iterated record should be passed through a tMap as well. Can someone please let me know what are the components and how to arrange them in order to get this done?
Thanks and Regards,
Asanka.
I have a scenario where I need to iterate over java arraylist and then I need to update database table for each entry in the arraylist. Fore each record I need to lookup other tables as well. Therefore the iterated record should be passed through a tMap as well. Can someone please let me know what are the components and how to arrange them in order to get this done?
Thanks and Regards,
Asanka.
242 Views
3 Replies

Anonymous
Not applicable
2015-02-05
11:06 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
on tJava component, get each item from arrayList and append each item to a string, the final string looks like:
...
String items="a,b,c,...";
And then, store the string to a global var or context var for used later.
On next subjob, generate this string on tFixedFlowInput (get the value of global var or context var), normalize the input string with tNormalize component to generate multiple lines, and then map the lookup data.
tJava
|
onsubjobok
|
tFixedFlowInput--main--tNormalize--main--tMap--main--tDatabaseOutputComponent
|
lookup
|
table
Best regards
Shong
...
String items="a,b,c,...";
And then, store the string to a global var or context var for used later.
On next subjob, generate this string on tFixedFlowInput (get the value of global var or context var), normalize the input string with tNormalize component to generate multiple lines, and then map the lookup data.
tJava
|
onsubjobok
|
tFixedFlowInput--main--tNormalize--main--tMap--main--tDatabaseOutputComponent
|
lookup
|
table
Best regards
Shong
242 Views

Anonymous
Not applicable
2015-02-06
12:28 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Shong,
Thanks for your reply. But this wont help in my scenario as there are millions of records in the arraylist and those records represents a custom object (not strings). Is there a way to iterate the list and process each record (each item of the list) through tMap?
Thanks and Regards,
Asanka.
Thanks for your reply. But this wont help in my scenario as there are millions of records in the arraylist and those records represents a custom object (not strings). Is there a way to iterate the list and process each record (each item of the list) through tMap?
Thanks and Regards,
Asanka.
242 Views

Anonymous
Not applicable
2015-02-08
04:42 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Asanka
This is just a simple example with basic data type. For complex type, like custom object in you case, you can use tJavaFlex to iterate the list and process each record.
BR
Shong
This is just a simple example with basic data type. For complex type, like custom object in you case, you can use tJavaFlex to iterate the list and process each record.
BR
Shong
242 Views
