Search code examples
javatalendtalend-mdm

Talend- How to replace string from 'MATCHING' column to 'contactFirstName' column


I have a very tricky situation and have yet to come up with my own solution using Talend. I have an input MySql that has a number of columns and need to copy first string from MATCHING column to contactFirstName column when VALUE column contains 1;1;1

i am using tjavarow component.

Required description: Click here for required description

Batch design: Click here for batch design


Solution

  • Using a simple tMap, use the following expression for contactFirstname field in the output flow:
    row46.VALUE.equals("1;1;1") ? row46.MATCHING.replaceAll(";.*$", "") : row46.contactFirstname

    Here is a capture of the tMap I use for testing: enter image description here

    Hope this helps.
    TRF