Search code examples
databaseinputtextpentahopentaho-data-integration

Pentaho Text File Input Have 2 Line in 1 Row


So I have text file like this:

Code   Prod_Name    Color   Stock        Price
201    Long         Lime    50           3900
       Shirt        Green
202    Short Skull  Dark    100          3900
       Shirt        Red 

And I want to be read like this:

Code   Prod_Name          Color         Stock        Price
201    Long Shirt         Lime Green    50           3900
202    Short Skull Shirt  Dark Red      100          3900

So how to achieve that only in Pentaho?

I have try text input using wrapped lines, but it doesn't seems the solution.


Solution

  • Tricky one. Don't think there is a standard step to achieve this. Is a pretty rare case imo. But you can do it... Just load the file and during load have rownumbers added. Then seperate even from uneven with a filter. Do rownumber-1 at the even side, and join the two sets together on rownumber. Then concat both versions of each field in the new set. (don't forget to trim fields in case a column doesn't have 2 lines, and the seperator space is added for no reason)

    Sollution

    Even better would be to repeat the ID number ("Code" in this case) in the insert and then to connect on this field:

    Alternative

    Result:

    Result_image