cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing a string into 2 columns

jdsnap
New Contributor II

Hi, I am trying to parse a list I am getting and putting it into 2 columns.

My value is $email is (xyz@test.com, abc@de.com, 13432@me.com)

What I want to accomplish is parse out $email into two columns in mapper $primaryEmail and $secondaryEmail

I am able design the pipeline to get primary $email.split(‘,’,1). that returns xyz@test.com

By using the search function I am able to determine the index of the first , I was then going to slice it.

$email.search(‘,’) returns 13

how to I encapsulate that in a slice?

Any suggestions ? Thanks in advance.

1 ACCEPTED SOLUTION

Ah, sorry, misunderstood the requirement.

In that case, you could do something like this:

$email.split(',')[0] → primary
$email.split(',').slice(1).join(',') → secondary

Here’s an example pipeline to play around with if it’s helpful.

split-example_2022_04_06.slp (4.9 KB)

View solution in original post

5 REPLIES 5

jdsnap
New Contributor II

Thanks for both of your help.