cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to split a value into multiple fields

izzy_babcock
New Contributor II

Hello,

Say I have a .csv with the following row:

value1_value2_value3_value4_value5

How can I split the string by โ€œ_โ€ so each value can be mapped to its own field? I basically need to do stuff with each record, but through the Mapper I canโ€™t seem to figure out how to accomplish this.

Mapping from: โ€œvalue1_value2_value3_value4_value5โ€
To:
โ€œvalue1โ€
โ€œvalue2โ€
โ€œvalue3โ€
โ€œvalue4โ€
โ€œvalue5โ€

Thank you in advance.

Best,
Izzy Babcock

1 ACCEPTED SOLUTION

j_angelevski
Contributor III

Hello @izzy.babcock,

You can use .split() method in a mapper like this โ†’ $row.split("_"), this will create an array then you can simply map that value to the target path and after that use a JSON Splitter to split on the target path containing the array fields.

View solution in original post

2 REPLIES 2

j_angelevski
Contributor III

Hello @izzy.babcock,

You can use .split() method in a mapper like this โ†’ $row.split("_"), this will create an array then you can simply map that value to the target path and after that use a JSON Splitter to split on the target path containing the array fields.

thank you!