Hitachi Vantara Pentaho Community Forums
Results 1 to 10 of 10

Thread: How to fix number(x,y)

  1. #1

    Default How to fix number(x,y)

    Hi,

    I would like to fix in a transformation a concrete type and length (e.g, number(15,2), with +/-). But using Text File Input step (Fixed file),
    "fields"
    tab, "Format" column, I don´t see the way to fix it, with the corresponding precision and sign. Any suggestion?

    Thanks in advanced!

    Cheers!

  2. #2
    Join Date
    Nov 2013
    Posts
    382

    Default

    PDI has Number and BigNumber. Nothing else. You cannot fix an specific numeric type and length.

    But most probably your request is incorrectly formulated as you don't want to fix the transformation field ... what you want to fix is the output of your transformation, i.e. a field in a database table or in a text file or ... whatever you are storing it. So let us know where do you want to write it, with which step and maybe we can help you

  3. #3

    Default

    Hi DepButi,

    Actually the fact is that I´m recieving something like "+06349". In the technical specifications, it´s suposed to be NUMBER(5,0). But when I run the transformation, my file has "+" before the number, so it doesn´t allow me to store and fix
    "+06349"
    as a number (9)... in a csv file or in a table (e.g)


    Error converting line
    2018/01/17 17:03:14 - Couldn't parse field [Number(9)] with value [+07902220], format [null] on data row [1]. Unexpected conversion error while converting value [Id Cuenta String(9)] to a Number
    2018/01/17 17:03:14 -
    2018/01/17 17:03:14 - Cuenta String(9) : couldn't convert String to number
    2018/01/17 17:03:14 -
    2018/01/17 17:03:14 - Id Cuenta String(9) : couldn't convert String to number : non-numeric character found at position 1 for value [+07902220]

    Thanks in advanced !

  4. #4
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    You're going to have a lot of work ahead of you with that format.

    In your Format field for the numbers you are looking at, you have to manually specify the number format for the incoming field instead of letting PDI guess at it, since you have non-numeric characters in the field (- counts as numeric, + does not)

    For field Number(9), you will want a Format of "+000000000;-000000000"
    For field Number(5,0), you will want a Format of "+00000;-00000"

    https://docs.oracle.com/javase/8/doc...malFormat.html

  5. #5

    Default

    Ok, I see,

    But the point is that I don´t find this format in order to fix it and grant the right treatment for something like "+7575775"...

    Name:  options.jpg
Views: 57
Size:  31.8 KB

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

    Default

    You can enter a format manually if necessary.
    So long, and thanks for all the fish.

  7. #7

    Default

    Quote Originally Posted by marabu View Post
    You can enter a format manually if necessary.
    Ok, Thanks marabú!

    But can I fix manually the sign? Is there any carachter in order to control the sign? Just trying to avoid to fix "+" or a "-" manually. Something like "S00000000,00"...

    Thanks in advanced!

  8. #8
    Join Date
    Nov 2013
    Posts
    382

    Default

    Quote Originally Posted by gutlez View Post
    For field Number(9), you will want a Format of "+000000000;-000000000"
    For field Number(5,0), you will want a Format of "+00000;-00000"
    This

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

    Default

    Gotcha!

    You didn't read the documentation for DecimalFormat linked by gutlez:

    A DecimalFormat pattern contains a positive and negative subpattern

  10. #10

    Default

    Quote Originally Posted by marabu View Post
    Gotcha!

    You didn't read the documentation for DecimalFormat linked by gutlez:
    Ok, ok, I´m sorry, I thought it was one of them only, and not both at the same time, "+" and "-"...

    Thank you so much!

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.