Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Unable to read number '+002.323' with Fixed Input step

  1. #1
    Join Date
    Nov 2015
    Posts
    20

    Question Unable to read number '+002.323' with Fixed Input step

    Hi,

    I must read a text file with fixed length fields in it, and there are a bunch of decimal fields conforming to the following pattern:

    • 1st char: plus or minus sign.
    • 2nd - 4th char: integer part of the number
    • 5th char: decimal point
    • 6th - 8th char: decimal part of the number


    Examples:
    +100.000
    -023.240
    +000.000
    +001.000


    I cannot get the number recognized by the "Fixed Input" step.
    Is there any solution without adding another step?

    The only way I found to read the number is to set the field type to String and then try to process it in other step after this one.
    Which would be the best solution for transforming the string field into the correct number field (take into account there are 30+ fields of this type in the record)?

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

    Default

    You forgot to tell us the format string you are using.

    I would use something like '+'000.000;-000.000
    So long, and thanks for all the fish.

  3. #3
    Join Date
    Nov 2015
    Posts
    20

    Default

    I have used the format 0000.000;-000.000 and +000.000;-000.000. And neither of them work, even the second format is not correct because the + sign is not recognized.

    I will try your suggestion: '+'000.000;-000.000

  4. #4
    Join Date
    Nov 2015
    Posts
    20

    Default

    The solution from marabu worked flawlessly.

    Thanks, marabu.

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.