Hitachi Vantara Pentaho Community Forums
Results 1 to 8 of 8

Thread: Converting ZIP Code

  1. #1
    Join Date
    Aug 2008
    Posts
    12

    Default Converting ZIP Code

    I've figured out how to do some more complicated stuff with kettle, but for the life of me can't figure out this simple task...i assume kettle is the best place in the pentaho architecture to accomplish this.

    I have zip codes that are both 5 digit (80237) and 5+4 format (80237-7734).

    When i'm running my transformation, i want to make all the zipcodes 5 digits only.

    What is the best way to do that?

    thx, k.

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    Probably a small snippet of javascript

    You want to always get the first 5 digits?

    Regards,
    Sven

  3. #3
    Join Date
    Aug 2008
    Posts
    12

    Default

    yes, always the first five. I want something like a mid(string,start_position, numberofspaces) function in excel and I'll do mid(zipcode,1,5)

    thx, k.

  4. #4
    Join Date
    May 2007
    Posts
    128

    Default

    Don't most of the file inputs have trimming options? If you are pulling from a database there is surely a function to preform this task (I personally like as few steps as possible in a transformation).

  5. #5
    Join Date
    Aug 2008
    Posts
    12

    Default

    If there was a trim function i didn't see how to use it.
    There is a trim option on setting the field properties, but my understanding from reading the doc was that that trimmed white space from before/after/both the data. There is a length property, which i tried setting to 5, but it didn't keep content longer than 5 characters from coming thru.

    I like a few steps as possible, too ;->

  6. #6
    DEinspanjer Guest

  7. #7
    Join Date
    Aug 2008
    Posts
    12

    Default

    Nice. Thanks...that was easy to get working.

    However, if that is the "correct" way to do it with Kettle, it begs the question: why is there the option to set the length of a field in the Table Output Mapping step? What is that for?

  8. #8
    DEinspanjer Guest

    Default

    It is for padding output fields. I can't honestly say that it has ever been useful to me, but I'm sure it must have been important to someone.

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.