US and Worldwide: +1 (866) 660-7555
Results 1 to 7 of 7

Thread: Stripping out the carriage return from strings

  1. #1

    Default Stripping out the carriage return from strings

    Attachment: JavaScript - Strip line feeds from text.ktr I have some data that when entered into the Borand Interbase database via a application contains the carriage return character. (its that little hollow square). I want to strip this from all the string using kettle. How might i go about this. I remember trying to do this before using kettle but having no luck =(


    regards



    Harris

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

    Default RE: Stripping out the carriage return from strings

    Matt Casters, Chief Data Integration
    Pentaho, Open Source Business Intelligence
    http://www.pentaho.org -- mcasters@pentaho.org

    Author of the book Pentaho Kettle Solutions by Wiley. Also available as e-Book and on the Kindle reading applications (iPhone, iPad, Android, Kindle devices, ...)

    Join us on IRC server Freenode.net, channel ##pentaho

  3. #3

    Default RE: Stripping out the carriage return from strings

    Cheers Matt! Worked a treat!


    =)

  4. #4

    Question

    Hi.
    Can't see attachment.
    what is the solution then?

    Thanks for your answer.

  5. #5
    Join Date
    Jun 2007
    Posts
    12

    Default

    Hi there. It appears that this attachment is no longer available... can I have it updated please? If there is an easier solution for the import of large files that have embedded carriage returns, just let me know. Have searched this forum, but not found a solution yet.

    Quote Originally Posted by MattCasters View Post

  6. #6
    Join Date
    Oct 2006
    Posts
    219

    Default Check the samples

    If you look in your PDI directory you will fine the sample here:

    samples/transformations/JavaScript - Strip line feeds from text.ktr

    There's all sorts of funky samples there

    Harris
    www.ivy-is.co.uk - Ivy Information Systems

    Come join the non official Pentaho IRC chat room on irc.freenode.net in the ##pentaho channel

  7. #7
    Join Date
    Jan 2007
    Posts
    981

    Default

    Although with the new User Defined Java Expression step in 3.2, I believe it would be much faster to have a Java expression: MyField.replace("\r", ""); or, if you can find a suitable single character replacement, even faster would be MyField.replace('\r', '?'); because it requires fewer string operations.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •