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?
Solved! Go to Solution.
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:
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.
To parse the string to an array use the JSON expression:
Expression: json(<formVariable>)
Super simple 🙂
HTH
Jay
Hey @McMonty
The following solution works albeit it it way more complex than I'd like!
1. Create an array of chars which need to be removed from the string: createArray('[',']','"')
2. Add a variable to store the 'Initial value' I've manually set the value...
3. Add a new variable to store the changing / new value
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(),'')
7. Add a 'Set Variable action' to copy the NewValue to the InitialValue variable... you can't self reference in the replace expression 😞
8. Finally... Add a another 'Set Variable' action underneath the 'Apply to each' loop to perform the final replace expression: replace(variables('InitialValue'),',','; ')
Your Flow config should look like this... a little convoluted but it works!:
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.
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 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.
Hi, my only question is where in the previous solution do I add / replace this?
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.
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:
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.
To parse the string to an array use the JSON expression:
Expression: json(<formVariable>)
Super simple 🙂
HTH
Jay
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 🙂
Hello Everone!
Thank you for solved !
Is it possible to skip lines for each string received from this solution?
How would you format the Body if you wanted the output to be the following?
Option 1
Option 2
Option 3
You can use the following expression in a Compose function: join(outputs('ConvertResponseToJSON'),'<br>')
Hello,
See below trick to using simply multiple choice answer and get row wise answers.
using join with <br> tag
json(outputs('Get_response_details'))
<br>
see the results..
Hope you like it.
Thanks,
Harsh
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
72 | |
27 | |
22 | |
15 | |
13 |
User | Count |
---|---|
141 | |
42 | |
42 | |
34 | |
30 |