Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Pentaho Spoon - Validate Fixed Width Input File Format

  1. #1
    Join Date
    May 2011
    Posts
    6

    Default Pentaho Spoon - Validate Fixed Width Input File Format

    I'm trying to process a fixed width input file in pentaho and validate the format. The file will be a mixture of strings, numbers and dates. However when attempting to process a number field that has an incorrect character present (which i had expected would throw an error) it just reads the first part of the number and ignores the bad char.
    I can recreate this issue with a very simple input file containing a single field:
    Name:  3.JPG
Views: 111
Size:  7.5 KB
    I specify the expected number format, along with start position and length:
    Name:  1.JPG
Views: 109
Size:  11.5 KB
    On running the transformation i would have expected the 'Q' to cause an error instead the following result is displayed, just reading the first two digits "67" and padding the rest to match the specified format:
    Name:  2.JPG
Views: 107
Size:  8.2 KB

    I'm currently using version 4.0.1

    Any help would be greatly appreciated, thanks!
    Last edited by t_barbz; 06-13-2011 at 06:50 AM.

  2. #2
    Join Date
    Sep 2009
    Posts
    810

    Default

    Hi there,

    as a workaround I'd suggest declaring all the fields strings on Text File Input and sending the fields to a Select Values step that does the conversions to numbers/dates as necessary. The Select Values should bomb if the formats don't match. It's probably best to file a jira for that as well, since Kettle should probably not pass through malformed fields silently.

    Cheers

    Slawo

  3. #3
    Join Date
    May 2011
    Posts
    6

    Default

    Will give that a try, thanks for the suggestion slawomir

  4. #4
    Join Date
    May 2011
    Posts
    6

    Default

    No luck. The full "67Q.89" string is read in the input text file stage, but when select values attempts to change the type it does the same as my original problem, resulting in just 67

  5. #5
    Join Date
    Dec 2009
    Posts
    332

    Default

    Silly question perhaps, but on the "Error Handling tab", do you have "Ignore errors" checked?

  6. #6
    Join Date
    May 2011
    Posts
    6

    Default

    Hi khelms, no - "ignore errors" is unchecked. For now i've decided just to read all values as strings and then validate them using regex before parsing to numbers. Does the trick, just a shame it isnt catered for in the input step. Thanks.

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.