cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KiranNr
Advocate II
Advocate II

Splitting comma separated string with values having comma

Hi,

 

I will be having a string like this --> Yes,No,"Other,Options", i need to split this string to output separate like 

Yes

No

Other,Options.

 

the string is a dynamic string, it can have multiple values separated by comma and those values can have comma inside them.

 

I tried using the split function with delimiter as ,(comma) but did not get the desired result as the value has the comma in it.

Please help.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @KiranNr 

 

Thank you for your further clarification.

 

If that’s the case, try this:

v-duann-msft_0-1616577511650.png

 

Flow in details:

split(first(split(outputs('Compose'),',"')),',')

first(split(last(split(outputs('Compose'),',"')),'"'))

 

v-duann-msft_1-1616577511654.png

 

v-duann-msft_2-1616577511659.png

 

Once tested, I’m able to get result as you required:

v-duann-msft_3-1616577511661.png

 

v-duann-msft_4-1616577511664.png

 

Thanks

Anna

View solution in original post

7 REPLIES 7
v-duann-msft
Community Support
Community Support

Hi @KiranNr 

 

Thank you for posting.

 

According to your description, you want to convert several string to array. If any misunderstanding, please kindly let me know.

 

We need to use multiple compose actions to achieve it.

 

Here is the flow for your reference:

v-duann-msft_0-1616572271509.png

 

Related expression in order:

first(split(outputs('Compose'),','))

substring(first(split(outputs('Compose'),',"')),4,2)

take(last(split(outputs('Compose'),',"')),13)

createArray(outputs('Compose_2'),outputs('Compose_3'),outputs('Compose_4'))

 

once tested, I’m able to get the output you want:

v-duann-msft_1-1616572271513.png

 

Hope the content above may help you.

 

Best regards,

Anna

Hi, thanks for the response.
but the CSV string will be dynamic, it will not exactly going to be like this -->Yes,No,"Other,Options"

the CSV string can vary in length and also number of comma separated values, and any value can have comma(,) in it.

Hi @KiranNr 

 

Thank you for your further clarification.

 

If that’s the case, try this:

v-duann-msft_0-1616577511650.png

 

Flow in details:

split(first(split(outputs('Compose'),',"')),',')

first(split(last(split(outputs('Compose'),',"')),'"'))

 

v-duann-msft_1-1616577511654.png

 

v-duann-msft_2-1616577511659.png

 

Once tested, I’m able to get result as you required:

v-duann-msft_3-1616577511661.png

 

v-duann-msft_4-1616577511664.png

 

Thanks

Anna

View solution in original post

Hi,

I tried what you have given but its failing while initializing the array.

KiranNr_0-1616578598642.pngKiranNr_1-1616578631425.pngKiranNr_2-1616578658921.png

KiranNr_3-1616578685636.png

 

Hi @KiranNr 

 

Thank you for your update.

 

May I know did you input formula in expression area? 

v-duann-msft_0-1616738904739.png

 

It won't get to work if you just paste in value area in variable.

 

Thanks

Anna

Hi ,

 

Thanks for pointing that out, i have made a change, now that error is gone.
But the flow is not extracting properly

Eg,For string - "Opion,Value",Yes,No,"Option1,Value"

its giving output like 

[
  "\"Opion",
  "Value\"",
  "Yes",
  "No",
  "Option1,Value"
]
 
its should give output like this 
[
  "Opion,Value",
  "Yes",
  "No",
  "Option1,Value"
]

 

 

Hi @KiranNr 

 

Thank you for your quick update.

 

If the amount of value is also dynamic. I'm pretty sure it's impossible to achieve it. These is no fixed method for all scenarios if you have comma inside.

 

I'm afraid you need to abandon unless configure a static format for the output from PowerApps.

 

Sorry for the inconvenience caused and thanks for your understanding.

 

Best regards,

Anna

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,724)