Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Combine Rows With different fields

  1. #1
    Join Date
    Sep 2012
    Posts
    21

    Post Combine Rows With different fields

    Hi all,

    I am a newbie of Kettle and have a issues would like to seek for help.

    I am implementing a transformation to combine two input sources (XML or Excel).
    They shares some common columns. And I would like to have a output like this.

    e.g.
    Source A
    Col1 Col2
    1 2
    3 4

    Source B
    Col2 Col3
    5 6
    7 8

    Result
    Col1 Col2 Col3
    1 2 null
    3 4 null
    null 5 6
    null 7 8

    Any ideas for a transformation to achieve this output?
    Thanks.

    P.S. Kettle 4.2.0 is the current version for my development
    Last edited by chung0825; 06-27-2013 at 11:09 PM.

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

    Default

    You add constant values after both Source A (col3) and B (col1), then you simply send the rows to the same step.

  3. #3
    Join Date
    Sep 2012
    Posts
    21

    Default

    Quote Originally Posted by MattCasters View Post
    You add constant values after both Source A (col3) and B (col1), then you simply send the rows to the same step.

    Thanks. So this mean I have to identify those different columns manually? Any Kettle steps can help to do this?

  4. #4
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    A generic design would use a (full outer) Merge Join.
    Add an integer constant 1 to source A, 2 to source B and use these as join keys.
    There's no way to tell this step to unify columns by name, so it's your job to do it.
    A JavaScript step could be helpful with that task.
    So long, and thanks for all the fish.

Tags for this Thread

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.