Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Text file input involving negative numbers

  1. #1
    Join Date
    Sep 2006
    Posts
    14

    Default Text file input involving negative numbers

    I am trying to load data from a csv file with negative numbers stored with either - or (). If I set the field format to #,###;(#,###), I will get a unparseable number error if the negative number is preceded by a -.

    Conversely if I set the field format to #,###;-#,###, the same error message will be displayed if the negative number is stored as (#,###).

    Are they any ways to overcome this in the text file input step?

    Tks & Best Rgds

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Hi Noob,

    Please attach a sample file because I really don't know what the problem is.
    You can indeed only specify a single format. Try/Retry is not something we support.
    You could do it in JavaScript with a try/catch system.

    Matt

  3. #3
    Join Date
    Sep 2006
    Posts
    14

    Default Text file input involving negative numbers

    I have attached a sample file (test.csv) and 2 transformations (test1 and test2) to illustrate the problem.

    I have currently overcome this by reading the field as a string and use a modified java script to replace the '-', the '(' & ')'.

    Best Rgds
    Attached Files Attached Files

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

    Default

    which is probably easiest... multiple formats are not supported in text input.

    Regards,
    Sven

  5. #5
    Join Date
    Jul 2012
    Posts
    2

    Default

    Quote Originally Posted by noob View Post
    I am trying to load data from a csv file with negative numbers stored with either - or (). If I set the field format to #,###;(#,###), I will get a unparseable number error if the negative number is preceded by a -.

    Conversely if I set the field format to #,###;-#,###, the same error message will be displayed if the negative number is stored as (#,###).

    Are they any ways to overcome this in the text file input step?

    Tks & Best Rgds
    'Hi Noob'
    Thank you very much
    I could solve my problem with negative fields,

    My problem was easier than yours
    I only expected negatives values with () format



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.