You are not logged in.

Dear visitor, welcome to Palo Community Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

  • "warwick.thresher" started this thread

Posts: 2

Date of registration: Mar 4th 2010

  • Send private message

1

Monday, May 14th 2012, 4:32pm

How to Split a field based on on delimiter using A script

Hi there

I need to split a field into multiple separate fields based on a semi-colon (;) delimiter.

Unfortunately the database I am connecting to holds ledger balances for each period in a single field with ";" delimiters. Hence I would like to write a script (Java? Groovy? Any suggestions?) that would take a field called "periodbal" e.g 123.34;234;18769.36 etc. and split into separate records.

Period 1 would be 123.34 in above example

Period 2 would be 234 etc.

Does anyone out there have the relevant code that coukld simply be pasted into the filed transform box in the ETL tool with Jedox Suite? I have read there is a Split function in Java but I am not sure how to write the specific code/script for it to work in my example.

Any help much appreciated. ?(

Posts: 217

Date of registration: Dec 2nd 2009

Location: Berlin

Hobbies: Born to work :-)

  • Send private message

2

Tuesday, May 15th 2012, 4:26pm

hi,

using a groovy script function, you can do the following.

myString="123;456;789";
amyString=myString.split(";");

amyString[0]
//returns 123

amyString[1]
//returns 456

etc.

hope it helps!
laloune

"To understand recursion, one must understand recursion"

  • "warwick.thresher" started this thread

Posts: 2

Date of registration: Mar 4th 2010

  • Send private message

3

Friday, May 18th 2012, 1:26am

Thank you so much - this worked perfectly and is going to save me a lot of time trying to build manual processes to convert the data.

Posts: 173

Date of registration: Jan 4th 2008

Location: Freiburg / Germany

  • Send private message

4

Friday, June 8th 2012, 2:11pm

Please note that with ETL 4.0 there will be a specific function "Split" for this purpose.

Used tags

Delimiter, Script, Split

Rate this thread