Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: How to edit row data with javascript

  1. #1

    Default How to edit row data with javascript

    Hi,

    Ive got specific problem with tranformation in kettle. Every ROW in input table contain data like "0RY40S09-H1". What i need is find way how to remove part begining with "-". So as final product i want to have just "0RY40S09".

    It is quite urgent, can someone help pls!!

    For case my icq is 156216206

    Thx a lot

    P.

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

    Default

    modified Javascript step:

    Code:
    var idx = field.getString().indexOf("-");
    var cleaned;
    if (idx>=0) 
    {
      cleaned = substr(field.getString(), 0, idx);
    }
    else 
    {
      cleaned = field.getString();
    }
    Put variable "cleaned" in the fields section below to add it to the row.

    Matt

  3. #3

    Default

    it works!!! thanks a lot mate!!

    Quote Originally Posted by MattCasters View Post
    modified Javascript step:

    Code:
    var idx = field.getString().indexOf("-");
    var cleaned;
    if (idx>=0) 
    {
      cleaned = substr(field.getString(), 0, idx);
    }
    else 
    {
      cleaned = field.getString();
    }
    Put variable "cleaned" in the fields section below to add it to the row.

    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.