Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: filtering string

  1. #1

    Default filtering string



    Hi, I Have a database with a table names "program". On the other hand, I have a colum with a table names "nameofprogram". I need to change the names of programs that start with "ESP" to code "01"; at the same time I need to rename the programs thar start with "ING" to code "02", the other one of names need to be rename with "03"
    all these information need to be save in the same colum and the others colums don´t change.

    Example:

    Before:

    TABLE: PROGRAM

    nameofprogram colum2 ...

    ESPECIALIZACIÓN EN GERIATRIA infcolum2 ...
    INGENIERIA MECATRONICA infcolum2 ..
    ESPECIALIZACIÓN EN ODONTOLOGIA infcolum2 ...
    DERECHO

    After:

    TABLE: PROGRAM2

    code .....

    01 infcolum2 ....
    02 infcolum2 ....
    01 infcolum2 ....
    03 infcolum2 ....

    How can I do this ? Anybody can send me a transformation file or something like this?

    Thank you for your help,
    Andrés Garc

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

    Default

    with a javascript step... try one for yourself and come back if it doesn't work. There are some examples in the samples directory.

    Regards,
    Sven

  3. #3

    Default

    Hi Mr.Sven. I don´t know how to resolve the problem with javascript, Can you give me another idea like functions or something like that ?

  4. #4

    Default

    uh, sorry to be blunt, but either learn to program, or hire professional services.

    If programsvariable startswith ESP replace ESP with 01.....not too hard in javascript (and that was psuedo code, not actual javascript).

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

    Default

    You could do it with 3 filters too.
    Or you could put the codes in a database if there are lots of them, together with the first 3 characters.
    javascript calculates: var a = substr(field, 0, 3);
    Then you can join a with the database to retrieve the number.

    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.