Snippet - Splitting Single Name Fields Into Two Names in Talend

This snippet was used with the tMap component in the variables section to take a single column name field from one database and split it into two fields for use with the tSugarCRM component.


row1.vc_Name == null || row1.vc_Name.length()==0 ? “null”:row1.vc_Name.split(” “)[0]

The snippet checks to see if the field is null or has a length of 0 before trying the split. Without this, if you had an empty entry then the split would crash your Talend script.

Originating code solution was found at: Talend Forum



Author: Josh Sweeney
Last Edited: May 12, 2010