On the Talend Exchange there are connectors for NetSuite. Great!
Plug in the user and password and grab a customer record. Easy!
Output the customer address list. Fail!
What? The address book is returned as an Object instead of rows with columns.
Ok, let's just send it thru the xml component and decompose it. Not!
It's a NetSuite java object at this point and not xml.
So what do we do ? Since the NetSuite java classes are available by virtue of the connector, we should be able to just use a tJavaRow component, assign it to the proper type (CustomerAddressbookList), and send it on down the stream. "Should" is the operative word here, but we can't because tJavaRow is looking to output one row for each row that is input, and the Addressbook list object has one or more address book entries.
globalMap to the rescue !
1) We'll use tJavaRow to get the addressbooklist broken into an addressbook array and put that object into a globalMap object. We'll also put the size of the array into a globalMap variable to use as our loop iterator.
globalMap.put("InternalId",input_row.InternalId);
globalMap.put("ExternalId",input_row.ExternalId);
CustomerAddressbookList ablist = (CustomerAddressbookList)input_row.AddressbookList;
CustomerAddressbook[] aba = ablist.getAddressbook();
globalMap.put("caba", aba);
globalMap.put("caba_Length", aba.length);
2) Our tLoop using the length
3) And finally a tJavaFlex to get the fields we want - notice that the array reference is the tLoop value variable
This methodology can be used to decompose any of the many NetSuite list objects.
Enjoy