Search code examples
sql-serverstringtalendsubstring

Get substring before comma of 1 field from Input table and insert in Output table in Tmap


I have a tMap which gets data from a table and has to upsert(update the existing and insert the new) the data in another table.
The input is having a field DETAILS, which has 2 values separated by Comma.
Ex 1234,567.8

Input table:

Input field

I need to feed the value before and after the comma in two columns in the output table.

Output Table:

Required output
Can I get any help?


Solution

  • If your input is a string, in tMap you can use row.field.split(",")[0] to put first value in X and row.field.split(",")[1] for Y.

    Edit: Make sure that your input field is not NULL to prevent null pointer exception

    Relational.ISNULL(row.field)?"":row.field.split(",")[0]