Four Stars

Use the below input and try to get the output

input:-  id                      name                      city

           1,2,3,4,5           a,b,c,d,e                krl,ndl,kphb,kp,null

 

 

Output:-  id               name           city

             1                     a               krl

             2                     b               ndl

             3                     c               kphb

             4                     d               kp

             5                     e              null

4 REPLIES
Six Stars

Re: Use the below input and try to get the output

Not sure what your purpose is as there is not a lot of context, but you could do something like :

 

Create 3 context variables.

 

Source flow ----main----->tJavaRow

 

Code for tJavaRow : 

 

context.idConcat += input_row.id + ",";
context.nameConcat += input_row.name + ",";
context.cityConcat += input_row.city + ",";

Then remove last comma if needed in a tJava component.

My output :

 

1,2,3,4,5,

a,b,c,d,e,

krl,ndl,kphb,kp,null,

 

 

 

 

Twelve Stars

Re: Use the below input and try to get the output

I'm assuming that this data arrives in one "row" of 3 values (id, name and city). From that you want to output 5 rows with 3 columns. I'm assuming you are trusting the order in which each of the input columns are ordered and that all 3 columns have the same number of elements within each of them. If that is the case, you may be able to use this tutorial (https://www.rilhia.com/quicktips/quick-tip-row-multiplication).

 

What I am doing here is multiplying rows by a value stored on the row. While you do not have a value representing the number of elements within each column, you can count the number of separator values (or commas in this case) and add 1. Once you have that, you can multiply the number of rows. The all you would need to do is split the three input columns by their separators. You can use a bit of Java to do this. Take a look here to see how (https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split(java.lang.String,%20int). Once you have your String array, you can use the row multiplication number (minus 1 since array indexing starts at 0) to return your value one row at a time.

Rilhia Solutions
Six Stars

Re: Use the below input and try to get the output

I completely misread the question it seems. +1 to Rilhia
Four Stars

Re: Use the below input and try to get the output

yes, We need to get them into rows 

 

Note:- Check once output