Split *each* row into four rows using splitrow?

One Star

Split *each* row into four rows using splitrow?

I need to split *each* row in a table into four rows in another. I'm trying tSplitRow per several posts and the Component Guide.
The Component Guide example shows how to split one and only one row into two columns. The values specified for the fields in the component's column mapping table are of the form: row1.InputColumnName. Is there a syntax for *each* row?
I want to transform a table with columns:
NPI | Specialty1 | Specialty2 | Specialty3
1 | A | B | C
2 | D | E | F
etc.
to:
NPI|Specialty
1 | A
1 | B
1 | C
2 | D
2 | E
2 | F
etc.
Using the row1.InputColumnName syntax, I get:
NPI|Specialty
1 | A
1 | B
1 | C
1 | A
1 | B
1 | C
etc.
Is there a way to specify: split every row?
Seventeen Stars

Re: Split *each* row into four rows using splitrow?

Yes, use a tMap and create one output and 3 joined outputs (using the first output).
One Star

Re: Split *each* row into four rows using splitrow?

I don't understand jlolling's response. I got it to work with:
tfileInuptDelimited -> tMap
-> tBufferOutput_1
-> tBUfferOutput_2
->TBufferOutput_3
On subjob okay
tBufferInput->tLogRow
tMap just creates three outputs, first one hast row1.NPI, row1.Specialty1, second is row1.NPI, row1.specialty2, finally third is row1.NPI, row1.specialty3


See http://www.talendforge.org/forum/viewtopic.php?id=8296, response from jhollman, next to last.
One Star

Re: Split *each* row into four rows using splitrow?

Hi holberger,
By using tSplitRow you can surely achieve the desired result. You just need to modify the schema of tSplitRow component according to the required schema and use add option to add your input put row and map it as your requirement. For clear understanding refer to the snapshot attached within.
Best Regards,
Mayur
One Star

Re: Split *each* row into four rows using splitrow?

Thanks Mayur,
I see your example seems identical to mine, but mine is not working properly. In my output, I just get the splits from the first row, repeated over and over, 33,703 times. It's as if the row number is never iterated from "row1". I get the proper 134,812 rows out, but they're the first four repeated (33.703 times).
I attached images corresponding to yours. Can you see what I'm missing? (In the output, note that some input rows have nulls in some Specialty fields. My first row has nulls in the 3rd and 4th Specialty field.)
One Star

Re: Split *each* row into four rows using splitrow?

Hi Holberger,
Your column mapping seams to be good and i don't think null value in the 3rd & 4th field can't cause this issue. I guess the issue can be in the input data to the tSplitRow component. You can do a small check for this, for time being include a tLogRow component after your tUniqueRow_2 component i.e. just before tSplitRow component to check whether the input data to the tSplitRow component is correct or not.
Because if the input data consist of the single row which is repeated multiple times then tSplitRow component is working as expected.
Let me know the out come.
Best Regards,
Mayur