Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Cut strings based on requirements

  1. #1
    Join Date
    Sep 2011
    Posts
    9

    Default Cut strings based on requirements

    I have a field which contains numbers formatted as strings beacause some contain ";". See below for a sample of 8 rows in the field:

    6064017194
    000144497203;006083877198
    8117847171
    000278937214;000017757162;000054875964
    7727167
    1292887195
    7753367171
    000171937261;000076097229

    There are two things that I want to do.

    First, I want to cut all strings starting with the leftmost ";" (if the string has one) onwards leaving me only the first string of numbers.

    Secondly, I want to remove the leading "0"s of all the strings.

    Basically I want to go from:
    000278937214;000017757162;000054875964
    to
    000278937214
    to
    278937214

    Do I use the formula step, the calculator step, or some other step?

  2. #2
    Join Date
    Aug 2010
    Posts
    12

    Default

    1. replace in string step to eliminate the rest after ;
    use RegEx: Y
    Search: ;.*
    2. replace in string step to eliminate the leading 0
    use RegEx: Y
    Search: ^0*

  3. #3
    Join Date
    Sep 2011
    Posts
    9

    Default

    That worked! Thanks!

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.