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

darshthakkar
Valued Contributor

Hi @arvindnsn,

Did you try using the basic concatenation function?

darshthakkar
Valued Contributor

I used a simple conditional statement in my mapper like below:

$field002!=""?" ' "+$field002+ " ' ":""
image

You might have to tweak a bit if youโ€™re expecting multiple values in your second stream.

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,

This worked perfect. I was trying something with the map function but was missing something. Thanks for the solution.