cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
McMonty
Level: Powered On

Multiple Choice data from Microsoft Forms

Hi,

I have a SharePoint list with data from a Microsoft Forms survey. One of the fields is a multiple choice field where the data looks like this:
["Option 1","Option 2","Option 3"]

 

I'm not sure if this is an array, but I'm trying to turn the above into the string below:

Option 1; Option 2; Option 3

 

Any idea how this could be done?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support Team
Community Support Team

Re: Multiple Choice data from Microsoft Forms

Hi @McMonty,

 

The output of the Choice type answer for MS Form will be string, so the only way to process the string to you want is some part of @Jay-Encodian's method 1.

 

You can add the replace function in the right Expression Bar:

Annotation 2019-12-02 170039.png

 

 

You can try this expression, the variables('Choice') is the output of your Choice answer:

replace(replace(replace(replace(variables('Choice'),'[',''),']',''),',',';'),'"','')

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Super User
Super User

Re: Multiple Choice data from Microsoft Forms

Hey@v-litu-msft @McMonty 

To parse the string to an array use the JSON expression:

a.png

Expression: json(<formVariable>)

a.png

Super simple 🙂

HTH

Jay

View solution in original post

7 REPLIES 7
Super User
Super User

Re: Multiple Choice data from Microsoft Forms

Hey @McMonty 

The following solution works albeit it it way more complex than I'd like!

1.png

 1. Create an array of chars which need to be removed from the string: createArray('[',']','"')

1.png

 2. Add a variable to store the 'Initial value' I've manually set the value...

1.png

 3. Add a new variable to store the changing / new value

1.png

4. Add an 'Apply to each loop'

5. Set the 'Output from previous steps' to the array variable created in step #1

6. Add a 'Set Variable action', add the following expression: replace(variables('InitialValue'),item(),'')

1.png

 7. Add a 'Set Variable action' to copy the NewValue to the InitialValue variable... you can't self reference in the replace expression 😞

1.png8. Finally... Add a another 'Set Variable' action underneath the 'Apply to each' loop to perform the final replace expression: replace(variables('InitialValue'),',','; ')

1.png

 Your Flow config should look like this... a little convoluted but it works!:

1.png

HTH

Jay

-------------------------------------------------------------------------

If I have answered your question, please mark your post as Solved.

If you like my response, please give it a Thumbs Up.

 

Super User
Super User

Re: Multiple Choice data from Microsoft Forms

Hey @McMonty 

So this was really bugging me yesterday... I thought there must be an easier way! and there is!

I forgot about the 'Join' action... much simpler:

a.png

 

a.png

 

A little bit simpler!

HTH

Jay

-------------------------------------------------------------------------

If I have answered your question, please mark your post as Solved.

If you like my response, please give it a Thumbs Up.

McMonty
Level: Powered On

Re: Multiple Choice data from Microsoft Forms

Hi, my only question is where in the previous solution do I add / replace this?

Super User
Super User

Re: Multiple Choice data from Microsoft Forms

Hi @McMonty 

The second post totally replaces the the first post... they are both complete answers that do the same thing in a different way.

The second post is obviously a lot simpler...

All you really need is the 'Join' action passing in your Form data... that's it 🙂

HTH

Jay

-------------------------------------------------------------------------

If I have answered your question, please mark your post as Solved.

If you like my response, please give it a Thumbs Up.

 

Community Support Team
Community Support Team

Re: Multiple Choice data from Microsoft Forms

Hi @McMonty,

 

The output of the Choice type answer for MS Form will be string, so the only way to process the string to you want is some part of @Jay-Encodian's method 1.

 

You can add the replace function in the right Expression Bar:

Annotation 2019-12-02 170039.png

 

 

You can try this expression, the variables('Choice') is the output of your Choice answer:

replace(replace(replace(replace(variables('Choice'),'[',''),']',''),',',';'),'"','')

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Super User
Super User

Re: Multiple Choice data from Microsoft Forms

Hey@v-litu-msft @McMonty 

To parse the string to an array use the JSON expression:

a.png

Expression: json(<formVariable>)

a.png

Super simple 🙂

HTH

Jay

View solution in original post

McMonty
Level: Powered On

Re: Multiple Choice data from Microsoft Forms

Hi all,

 

Big thanks to you both!

 

I created a variable containing the data from the multiple choice field and then used replace to get the string I wanted when creating the SharePoint item.

replace(replace(replace(replace(variables('Choice'),'[',''),']',''),',',';'),'"','')

You learn something new everyday 🙂

You learn something new every day 🙂

 

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Speakers, submit your sessions now! Call for speakers ends Feb. 10!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,237)