Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Modified Java Script Value: error counting occurrences of "+" in a string

  1. #1
    Join Date
    Oct 2011
    Posts
    6

    Default Modified Java Script Value: error counting occurrences of "+" in a string

    Hi all,
    i'm trying to find the occurrences of the "+" sign in a string. I used the Modified Java Script Value, calling the getOcuranceString(string, searchFor) function in my script. But i get this error:

    The function call getOcuranceString is not valid (script#7)

    If i change the string to search for (i.e the "-" sign), the function works perfectly. I tried this function in both Kettle 4.4.0 and the newest 5.0.1A, without succeeding. I think this is a bug.

    I've attached a sample of the job i'm trying to do, so you can fast check if i missed something or what.

    Thanks in advance for the help
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    The search string is compiled into a java pattern, so your literal must read "\\+".
    So long, and thanks for all the fish.

  3. #3
    Join Date
    Oct 2011
    Posts
    6

    Default

    Thank you very much, that worked.

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.