Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Normalise an unknown number of rows.

  1. #1
    Join Date
    Mar 2009
    Posts
    21

    Question Normalise an unknown number of rows.

    Hi,

    First of all, since this is my first post, I want to say, PDI/Kettle or however it will be called in the future, kicks butt. hehe And like Forest Gump once said, "That is all I have to say about that".

    About my question:

    I have some data in the stream I want to normalize however, the amount of rows is unknown.

    Is there any way I can obtain the following format?....

    Input:
    field1
    | field2 | field3 |field4
    a1 b1 c1 d1
    a2 b2 c2 d2
    a3 b3 c3 d3

    Desired Output:

    field1 | a1 | a2 | a3
    field2 | b1 | b2 | b3
    field3 | c1 | c2 | c3
    field4 | d1 | d2 | d3

    and so on...

    Remember I don'w know how many rows there are.

    Any ideas

    Right now what I get is 2 columns with the fields in one and the values in the others but once they get to the last field they repeat themselfe with the next row of original data.

    I hope that was clear enough

    Take care and thanks in advance.

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Nope, that is not possible since this problem is like a box of chocolates and you never know what you're going to get in advance.

  3. #3
    Join Date
    Mar 2009
    Posts
    21

    Thumbs up

    This is a tragedy. I am not sure if I will be able to live with this. hehe

    I will find another way to do this and post a work around.

    Thanks for your quick answer, now I can brag I got a replay from you. hehe well at least at work, since here you answer pretty much everyone hehe

    Take care and thanks again for your help.

  4. #4
    DEinspanjer Guest

    Default

    Well, if you don't care for your health or sanity, you can always irradiate the box and extrapolate how many creams are in it..

    That said, here is an example of abusing a text file output step to get the output you were looking for. This method won't work if the number of columns is variable too.
    Attached Files Attached Files

  5. #5
    Join Date
    Mar 2009
    Posts
    21

    Default

    As it turns out to leave everything denormalized is fine with my boss, so... I guess I won't be trying to find a work around.

    One I though about but it would need some thought to implement is to use the join rows (cartesian product)

    Since this is an incremental process to keep historical information, that object (join rows) plus a filter, can do the job, by comparing the columns with the headers.

    Anyway, now I will just export it to excel and do it there.

    Too bad the excel output object can't receive a parameter as the name of the file like the text output object.

    Anyway, thank you for your help.

    Kettle has been of great help, and I hope I can keep learning about it.

    ttfn

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.