How to split one line in different lines in TALEND

I need help to migrate one row from old DB to multiple lines in my new database.

I have data like:

OID       CUSTOMER_NAME     DOB            ADDRESS
1          XYZ              03/04/1987    ABC

      

In my new DB, I store data in a KEY VALUE pair, for example:

OID      KEY            VALUE
1      CUSTOMER_NAME    XYZ
1      DOB             03/04/1987
1      ADDRESS        ABC

      

Someone please help me how to do this using the TALEND tool.

+3


source to share


5 answers


you can use multiple tMap output associated with the same output as one possible solution. But this is not dynamic. why can you split one line into multiple lines in the source select query itself?

if you want to use this tmap parameter see below



tOracleInput (anyotherinput) → TMAP → TOutput / tlogrow

Take this line as input tmap component and in tmap create one output group say out_1. Now in this column out_1 drag and drop and links OID and CUSTOMER_NAME from input. Now create another output group out_02 in this tmap and when the Add Output dialog box appears select "create join table from" and from the dropdown select the group out_1 so that our output rows from this group out_02 will also go to group out_01. This way our tmap will only have one output group out_01 containing lines from out_01 and out_02. now in out_02 OID and DBO columns drag and drop and link. similarly repeat it for out_03 and the OID reference and ADDRESS column.

+2


source


After spending an hour or two I found a solution using Talend and without writing a separate line of Java code. if you follow all my steps then you will get the desired result.

Note. I used your Inputs as a source for this development, so actual data may vary.



  • Add tMap after the input source.
  • concatenate original coma columns in one column.
  • a semicolon is added at the end of the concatenated columns. see the picture for more details. enter image description here

    • After the tMap, add the tNormalize component and configure it as in the image. enter image description here
    • add tDenormalize component and do the setting as in the image. enter image description here
  • Add the tExtractDelimitedFields component and the configured one shown in the image. enter image description here

  • Add another tMap and configure as shown in the picture. enter image description here
  • You now have two output streams, so add another tNormalize component for each output. enter image description here
  • Configure the first tNormalize component as shon in Image. enter image description here
  • configure the second component tNormalize with the setting below shown in the image. enter image description here
  • Our final work will look like below. enter image description here
  • After doing all these steps, you will receive this output enter image description here
  • Now you can create another sub job to process this output for the connection and create a new one as per your requirement.
0


source


tOracleInput (anyotherinput) → tSplitRow → TOutput / tlogrow

Snap1

Snap2

0


source


you can use tPivotToColumnsDelimited. Read more about this in the Talend Help Center. This component will rotate your table based on the specified row. Thank.

0


source


Use tSplitRow for this. See below.

Talend task:

enter image description here

output:

enter image description here

0


source







All Articles