Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: String operation with delimiter

  1. #1

    Default String operation with delimiter

    HI,

    I have a field with delimiters.If the field name, delimiter and the occurrence are given as input, i need that particular part of the string to be displayed.

    For example,
    if a field 'Name' is having values like Aaa,Bbb,Ccc
    inputs-Name,',',3
    Expected output is Ccc

    Can this be done??? I tried using Split fields to rows. But it dint work.


    Please Help

  2. #2
    Join Date
    Aug 2008
    Posts
    563

    Default

    Can you post a sample transformation? It's not quite clear to me where to information about the "occurrence number" of the string is coming from. Is it part of the source data or you just define it as a constant within the transformation?
    Also, how many comma separated values can there be? Is it always 3 or does it vary? What's the max number of values?

    Depending on your answer, there can be various solutions to extract a certain value from a comma separated list.
    Best regards,
    Diethard
    ===============
    Visit my Pentaho blog which offers some tutorials mainly on Kettle, Report Designer and Mondrian
    ===============

  3. #3

    Default

    Hi,
    The occurence number is a constant which user defines.
    The number of comma separated values is unknown. It may vary. There is no limit for the number of values.

    please help.

  4. #4
    Join Date
    Jun 2007
    Posts
    260

    Default

    In javascript step
    parts = user_data.split(",");
    occurence_number = parts[parts.length -1]
    var value = parts[occurence_number -1];
    Last edited by crafter; 11-07-2011 at 01:12 PM. Reason: more detail

  5. #5

    Default

    Thanks a lot It works like a charm

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.