
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Adding each row of a table to collection(HashMap)
Hi,
I wanted to parallel execute the same child job with the values read from a table.
How can I do this?
Using tSetGlobalVar I have set 2 global HashMap varaibles - say sharedMap1 and sharedMap2 in tPrejob step.
In sub-task, I am reading the table - fromId, toID and many other fields.
I wanted to save each row values to the collection - 1st record to sharedMap1, 2nd record to sharedMap2.
How can I achieve this?
Then using tParallelize I can call both the tRunJob with the HashMap variables.
Thanks.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Its working now.
tDBInput ---->(row1 Main) tJavaFlex
|
| (OnSubjobOk)
tJava_2
tJavaFlex:
start code:
java.util.List<java.util.Map<String, String>> sharedList=new java.util.ArrayList<java.util.Map<String, String>>();
Main code:
sharedList.add(new java.util.HashMap(){{
put("ID",row1.ID);
}}
);
End code:
globalMap.put("sharedList",sharedList);
tJava_2:
System.out.println(((java.util.ArrayList)globalMap.get("sharedList")).size());
System.out.println(((java.util.HashMap)((java.util.ArrayList)globalMap.get("sharedList")).get(0)).get("ID"));

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you please provide the sample job flow screenshots with some sample input datasets you are trying to process and output datasets you are trying to achieve?
Warm Regards,
Nikhil Thampi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Please find in the attachment.
For testing I have created a sqlite table called TEST with single column - ID as int.
Thanks
job_test_tParallel.zip

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Its working now.
tDBInput ---->(row1 Main) tJavaFlex
|
| (OnSubjobOk)
tJava_2
tJavaFlex:
start code:
java.util.List<java.util.Map<String, String>> sharedList=new java.util.ArrayList<java.util.Map<String, String>>();
Main code:
sharedList.add(new java.util.HashMap(){{
put("ID",row1.ID);
}}
);
End code:
globalMap.put("sharedList",sharedList);
tJava_2:
System.out.println(((java.util.ArrayList)globalMap.get("sharedList")).size());
System.out.println(((java.util.HashMap)((java.util.ArrayList)globalMap.get("sharedList")).get(0)).get("ID"));
