Hitachi Vantara Pentaho Community Forums
Results 1 to 10 of 10

Thread: Merge 2 column field into 1

  1. #1
    Join Date
    May 2016
    Posts
    9

    Post Merge 2 column field into 1

    Hi,

    I need to merge the data of column "country code" and "border country code" into "country code" (picture below)
    I want the resulting table to have 1 column to have values from both fields.
    Please suggest how can I achieve this!!


    Name:  Screenshot from 2016-06-16 02:24:59.jpg
Views: 659
Size:  25.0 KB.

  2. #2
    Join Date
    May 2014
    Posts
    358

    Default

    Use two Select values steps and copy the stream to them (make two hops, select the "copy" option). In the first SV, select only column "country_code". In the second, select "border_country_code" but rename it to "country_code". Then connect them both to one step - there you will only have one column and all values in it.

  3. #3
    Join Date
    May 2016
    Posts
    9

    Arrow

    Hi,
    Thanks for the idea. However I am encountering an error stating : "border country code" row cant be found in the 2nd select value stage.
    Please refer the below attached picture. Could you please suggest where am I going wrong.

    Name:  Screenshot from 2016-06-16 21:22:33.jpg
Views: 529
Size:  24.8 KB


    Name:  select bccode.jpg
Views: 499
Size:  9.3 KB

  4. #4
    Join Date
    Apr 2016
    Posts
    156

    Default

    Border_Filter step will only send 'True' output down one path (not copy to the two Select Values).

    Try sending filter's 'True' step to a dummy step, then copy from the dummy step to the two Select Values.

    Example:
    Name:  2016-06-16_15-50-45.png
Views: 499
Size:  12.3 KB

  5. #5
    Join Date
    Apr 2015
    Posts
    18

    Default

    You could always try using the Concat Fields step to concatenate the two together in a new field, then go back and use the Select Values step to remove the original Country Code and Border Country Code fields.

  6. #6
    Join Date
    May 2016
    Posts
    9

    Default

    I tried this but it gives the same error.

    Error:
    Name:  Screenshot from 2016-06-16 23:22:04.jpg
Views: 520
Size:  27.1 KB

    Select border code
    Name:  Screenshot from 2016-06-16 23:22:27.jpg
Views: 492
Size:  11.1 KB

    meta data
    Name:  Screenshot from 2016-06-16 23:22:39.jpg
Views: 501
Size:  13.7 KB

    thanks

  7. #7
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    Try to not use more than one tab of the Select Values step at any given time.

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

    Default

    The Select-Value tabs are processed from left to right, so e.g. if you drop fields in the first tab they can't be addressed in the other tabs.


    Name:  207414.png
Views: 476
Size:  5.5 KB
    Attached Files Attached Files
    Last edited by marabu; 06-20-2016 at 02:53 AM. Reason: Added image
    So long, and thanks for all the fish.

  9. #9
    Join Date
    Apr 2016
    Posts
    156

    Default

    @atmatul: are you maintaining transformations created by someone else? If so, it may help to pick up some of the books on using PDI to help understand the processing.

    First: as mentioned below, a good idea is only to use one tab of the Select Values step. Remove the values from the 'metadata' tab to make sure they don't get processes.

    Second: make sure in your Select Values steps' "Select & Alter" tab that you don't use the checkbox at bottom about including unspecified fields

  10. #10
    Join Date
    May 2016
    Posts
    9

    Default

    Thanks a lot. Removing the fields from other tabs resolved the issue.

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.