Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: How to implement IS_NUMERIC, IS_ALPHANUMERIC in filter step?

  1. #1
    Join Date
    Sep 2005
    Posts
    1,403

    Default How to implement IS_NUMERIC, IS_ALPHANUMERIC in filter step?

    I have this text file with columns. I have no problem retrieving them. however, some columns are weird in such a way that they have non-numeric chars in columns that should have numeric characters. I am performing a calculation so when these rows hit the calculator, there is an error.


    "Division can only be done with numeric data!"



    I havent seen the actual rows that causes the error but the error message clearly says that it is fed by non numeric data.



    How can I implement the IS_NUMERIC filter? i cant see something like this in the filter step. Are there any way?



    Thanks!



    - Cholo -

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

    Default RE: How to implement IS_NUMERIC, IS_ALPHANUMERIC in filter step?

    Hi Cholo,

    I never came across anything *this* bad ;-)
    You mean you don't know whether the characters in a string are numeric in nature or not?

    I propose that you use a piece of Javascript for this.
    Loop over the characters in the String and see if they are all 0-9, minus, decimal, etc.
    Then just add a flag IS_NUMERIC Y or N, do a filter on that.

    HTH,
    Matt

  3. #3
    Join Date
    Sep 2005
    Posts
    1,403

    Default RE: How to implement IS_NUMERIC, IS_ALPHANUMERIC in filter step?

    Well yeah! the data is really bad! It has about one hundred rows that are erroneous. I think it was an error during a system migration years back. The system cannot be corrected because it can cause the company additional money to change something. So what we are doing is downloading the data from the erroneous server and we transform it using kettle. the transformed data is then used in our data warehousing project.

    Well, I will just use the javascript thing.

    Thanks!

    -Cholo-

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

    Default RE: How to implement IS_NUMERIC, IS_ALPHANUMERIC in filter step?

    Hi Cholo,

    I thought about this, maybe we can add a couple of methods to the Value class that do this for you:

    isStringNumeric(), isStringAlphanumeric(), ...

    If you like this, add a feature request for it in the trackers.
    It would make things easier for the people that come after you and have to solve the same puzzle.

    In any case thanks for the feedback!

    Matt

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.