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.
source to share
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.
source to share
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.
- After the tMap, add the tNormalize component and configure it as in the image.
- add tDenormalize component and do the setting as in the image.
-
Add the tExtractDelimitedFields component and the configured one shown in the image.
- Add another tMap and configure as shown in the picture.
- You now have two output streams, so add another tNormalize component for each output.
- Configure the first tNormalize component as shon in Image.
- configure the second component tNormalize with the setting below shown in the image.
- Our final work will look like below.
- After doing all these steps, you will receive this output
- Now you can create another sub job to process this output for the connection and create a new one as per your requirement.
source to share