Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: How to substring the string?

  1. #1
    Join Date
    Oct 2008
    Posts
    21

    Default How to substring the string?

    For example, I have a string '3010178', now I want to substring the foregoing 5 character '30101' and output it, how can I do it?

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

    Default

    Javascript step... look at some of the Javascript examples under the samples/transformations directory. I remember some doing similar stuff.

    Regards,
    Sven

  3. #3
    Join Date
    Oct 2008
    Posts
    21

    Default

    Quote Originally Posted by sboden View Post
    Javascript step... look at some of the Javascript examples under the samples/transformations directory. I remember some doing similar stuff.

    Regards,
    Sven
    Thank you so much for your help. Now i have new question, I want to remove all string which length less than 8(means string.length() <= 8) from one column, how can I do it?

  4. #4

    Default

    May be...

    if(MyColumn.getString().length()<=8)
    MyColumn.setNull()

    ...?

  5. #5
    Join Date
    Oct 2008
    Posts
    21

    Default

    Quote Originally Posted by biuri View Post
    May be...

    if(MyColumn.getString().length()<=8)
    MyColumn.setNull()

    ...?
    i found the way, add
    select * FROM table where length(column_name)=9 in database input.

  6. #6
    Join Date
    Oct 2008
    Posts
    21

    Default

    I created chinese site for pentaho http://www.pentahoclub.cn/
    Please check it if anyone in China.

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.