I am newish to Pentaho and I've been working on writing some Javascript that will take in an inconsistent text file (see related post: http://forums.pentaho.com/showthread...al-file-format) and pull out only the data I need.
Right now, I am having difficulty using Javascript to split the incoming file on the new line character. I assumed that just using something like this would work:
Unfortunately, it was unsuccessful (the whole file was still returned as one string). After some searching on the forums I found slightly different syntax, so I tried:
I had the same result - the string didn't split on new lines. After some more searching, I found a suggestion that someone posted where they defined "\n" as a variable in a job and then used it in the Split Field to Rows step so I tried that, but still had no success. As an aside, I have been able to successfully split on whitespaces/etc., just not new lines.
How can I split the file to rows based on the new line character?
(As an aside, it would be awesome if the Split Field to Rows step had a couple optional check boxes/radio buttons for common "special" delimiters under the Delimiter field, such as new line and possibly tab...)
Right now, I am having difficulty using Javascript to split the incoming file on the new line character. I assumed that just using something like this would work:
Code:
var parts = someField.split("\\n");
Code:
var parts = someField.getString().split("\\n");
How can I split the file to rows based on the new line character?
(As an aside, it would be awesome if the Split Field to Rows step had a couple optional check boxes/radio buttons for common "special" delimiters under the Delimiter field, such as new line and possibly tab...)