Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Ammar2
Contributor
Contributor

Split one row of multiple columns into multiple rows

hey!

i am getting input from api's and want to show in Tlogrow.

but when i split one row values into multiple rows in tjavarow then getting only one last row instead of all 3

my javacode is this

// Input columns

String PARMETADAT_ID = input_row.PARMETADAT_ID;

// Split each column into multiple rows

String[] PARMETADAT_ID_Values = PARMETADAT_ID.split(",");

// Iterate over the arrays and output each combination

for (int i = 0; i < PARMETADAT_ID_Values.length; i++) {

  // Set the PARMETADAT_ID for the current iteration

  row11.PARMETADAT_ID = PARMETADAT_ID_Values[i];

  // Output the row

  System.out.println("Output Row: " + row11.PARMETADAT_ID);

   

  // Emit the row (if you're using an output link)

  output_row = row11;

  // ... (any additional logic or processing)

}

output:

Output Row: 6c4e33bb-a7c8-4d71-8594-868eefeb841f

Output Row: 75b9248a-5228-4e69-a862-c0927d5a66ca

Output Row: 9ed56adf-063d-4438-b205-ad4b3b2b0844

.------------------------------------.

|       tLogRow_3       |

|=----------------------------------=|

|PARMETADAT_ID            |

|=----------------------------------=|

|9ed56adf-063d-4438-b205-ad4b3b2b0844|

'------------------------------------'

row11 is my output link to the tlogrow and PARMETADAT_ID is my column name

my job design is this

my job design

069U1000001kG64IAE.png

my tmap output is for one column

123haskjdjkasd,12321uiasdhjksdahsk,2132jhsahdsjadjkasdhjk,

if i use tnormalize component then i will have to use multiple tnormalize components but its not good approach i thnk so

please help me

12 Replies
Ammar2
Contributor
Contributor
Author

My indexes could be [0] to [20]

konvertilo
Partner - Contributor III
Partner - Contributor III

ok, that was a try. So you need to implement a java routines to do the job for you because denormalizing a variable list of columns, containing a variable list of items is definitively not doable in Talend Studio out of the box.

konvertilo
Partner - Contributor III
Partner - Contributor III

sorry I was busy with something else.

here is the solution : java custom code (variable number of items) + tnormalizer

069U1000001uouQIAQ.png