Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Which transformation to use

  1. #1

    Default Which transformation to use

    I am reading data from csv file and loading into the table. Target table has one derived column which is derived from column coming from the source. This derived column need to be populated that data such that if length of a column coming from source more than 4chars then populate column A else Column B.

    Data is like this in file
    Colum A , Colum B , Key
    1,2,0000
    3,4,00

    What I need in table is like this
    Colum A , Colum B , Key, Derived column
    1,2,0000,1
    3,4,00,4

    Can not fin any function in calculator/string operation etc which can be used to calculate the length of a string column. Also if else clause will be required for the same .

    Any pointers will be greatly appreciated. Can explore further if someone can help with the name of transformations which needs to be used.

    Regards
    Hemant Jain

  2. #2

    Default

    You could do this with a Javascript step.
    Pentaho BI Solutions for ERP
    www.erpbisolutions.com

  3. #3
    Join Date
    Nov 2008
    Posts
    777

    Default

    Use the Formula step. It has a LEN function and an IF construct.

    You could also use either the Modified Java Script Value step or the User Defined Java Expression step but both will require a little knowledge of the Java language.
    pdi-ce-4.4.0-stable
    Java 1.7 (64 bit)
    MySQL 5.6 (64 bit)
    Windows 7 (64 bit)

  4. #4
    Join Date
    Apr 2008
    Posts
    1,771

    Default

    In PDI 4.3:
    Calculator step: Return the Length of String A.

    Mick

  5. #5

    Default

    Thanks . Was able to do the same using calculator and Forumla.

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.