Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Concatenate fixed values to several columns

  1. #1
    Join Date
    Mar 2016
    Posts
    19

    Default Concatenate fixed values to several columns

    Hi there


    I need to do this. I am getting several columns that I need to modified like this:

    Prefix+Column_Calue+Suffix


    The values for Prefix and Suffix are always the same for all the new columns, the length of the column is been reduced . Now I wonder if there is a way to reach this without using the "Concat Fields" and the "Cut" steps, given that the number of columns could increase later, and I would like to do this (if possible) in one step.


    Regards.
    Last edited by d2907; 03-22-2016 at 01:15 PM.

  2. #2
    Join Date
    Apr 2008
    Posts
    4,690

    Default

    You can use a few lines of Calculator step:
    1) Set column to constant A,Column A:Prefix Remove:Y
    2) Set column to constant A,Column A:Suffix Remove:Y
    3) A+B+C, A:PrefixColumn, B:Column_Value, C:SuffixColumn, Remove: N

    You can also use the formula step, or the User Defined Java Expression step, both of which are also very quick steps.

  3. #3
    Join Date
    Mar 2016
    Posts
    19

    Default

    Thank you for your reply. I did not know how to make reference to input columns in the formula expression, I was used to see expression like ${variable}, but after look for a solution (thanks to your answer), I realised that for columns, the notation is just [column_name].
    Right now this component is working perfectly for me.

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.