Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: extracting two leftmost characters from string

  1. #1

    Default extracting two leftmost characters from string

    Hi all

    I'm trying to get the two first characters from the language field extracted via Google Analytics Step, so when getting en-gb or en-us the final string would be just en
    I've added a "String Operations" step. With settings :
    - Padding left
    - Pad Length 2

    But the result keeps showing en-gb and en-us with no padding at all


    Any hint would be much appreciated

  2. #2
    Join Date
    Oct 2011
    Posts
    3

    Default

    use String Cut

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

    Default

    Or Split Fields - so many options ...
    So long, and thanks for all the fish.

  4. #4

    Default

    hi

    thanks for your quick response but I understand (please correct me if i'm wrong) that the correct and proper way to accomplish this task is using a "string Operations" step. So, my problem is getting proper results with that step.
    Maybe I'm not right and I misunderstood what "padding" means (english is not my mother tongue). I think "padding 2 characters left" stand for "cutting 2 characters at the left part of string".

    am I wrong?


    thanks again
    Last edited by Joselitux; 06-25-2013 at 02:24 PM.

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

    Default

    Even though there is a step named String Operations, you won't find each and every string operation there.
    Padding refers to the process of adding a filler to a short string until a minimum length is reached - this doesn't help in your case.
    String Cut, as posted by joer, is the right advice for extracting substrings defined by offset and length.
    With Split Fields you can specify a character (even a string) that separates the substrings you are interested in.
    Just two major concepts for string extraction, you see?
    So long, and thanks for all the fish.

  6. #6

    Default

    Thanks a lot for your response marabu
    I was wrong.
    I'll use string cut instead.

    thanks again

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.