Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Append character to a string

  1. #1
    Join Date
    Sep 2011
    Posts
    171

    Default Append character to a string

    Hello everyone!

    I have a string, for example "illustration". I would like to add word "Super" in-front of it, so the result would look like
    "Superillustration". Does anybody know the appropriate transformation? Padding in string operations would pad up to certain length, since I do not know the length of incoming string I can not use. Also I can use java script, but wonder if there are any other methods?

    Regards,
    Alex

  2. #2
    Join Date
    Mar 2006
    Posts
    170

    Default

    Hi,

    Perhaps use the Calculator step.

    Add a Set field to Constant Value A ... in the value put in Super, set the rest of the settings maybe even remove = y.

    Add another that is A + B and in the A you will chose whatever you called above. B will be your incoming dynamic value that you want to concat with.

    Should work.

    Good Luck!

    Kent

  3. #3
    Join Date
    Sep 2011
    Posts
    171

    Default

    Great! Thank you! It worked with add constant component.

    Now I am thinking, after this transformation I get an extra field from calculator (the one that contains appended string), I can replace original field with new field value and be happy or I can use Modified Java Script from the very beginning. So Java Script block will replace three different blocks.

    Do you think I am going to loose in speed by using Modified Java Script instead of three standard blocks?

    Regards,
    Alex

  4. #4
    Join Date
    Mar 2006
    Posts
    170

    Default

    Hi,

    Well from what I've read etc... you are better using 3 steps instead of one JS step.

    The steps take up real estate in spoon GUI but outperform the JS when running.

    But do your due diligence and test it out ... if you have a small volume of data you most likely will not see any difference.
    It's the large volumes that "show" differences like this.

    Good Luck!

    Kent

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.