cancel
Showing results for 
Search instead for 
Did you mean: 

Add single quotes in comma separated string

arvindnsn
Contributor

Hello,

I have a scenario where the location name will come in 2 different scenarios from an API as mentioned below.

  1. LOC1
  2. LOC1, LOC2, LOC3

The expected output should be

  1. ‘LOC1’
  2. ‘LOC1’, ‘LOC2’, ‘LOC3’

I tried using the split and replace function but in vain. Appreciate any help provided here

Thanks
Aravind N

1 ACCEPTED SOLUTION

Abhishek_Soni37
Contributor

@arvindnsn

With this expression, you should be able to make it work.
image

pipeline:
Test_Expression_2023_06_17 (1).slp (3.5 KB)

Let me know if that helps.
🙂

Cheers,

View solution in original post

8 REPLIES 8

jcornelius
New Contributor III

‘"+ $yourfield.split(’,‘).join(’','‘) +"’

Good to know using the simple join function to achieve the output. Thank you!!

darshthakkar
Valued Contributor

Yes, multiple ways to achieve the desired output. Some cover all use cases and some won’t. If you have an edge case scenario, that will need a custom formula.

Yes, Correct. Thank you for the suggestion and input!!