Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Triggers
  • Resources
  • ABOUT ME
  • Get help with your flow
Menu

Split choices in multiple selection Forms question with Power Automate

Posted on July 21, 2021February 11, 2022 by Tom

“I’ve got a multiple selection choice question from MS Forms that I’d like to split into separate choices, how can I do it in Power Automate?”


While an array has a given format [“value1”, “value2”], it doesn’t mean that each string in such format will be considered as an array. It often depends on the source of the string. If it’s a multiple choice question in MS Forms, it’ll be a string. If it’s stored in a SharePoint column, it’ll be a string as well.

It can be a bit confusing as if you enter the value into ‘Compose’ action, it’ll show you the right array format. But this happens only because the ‘Compose’ action removes escape characters. When you ‘Show raw inputs’ you’ll see these escape characters that are otherwise ignored.

These characters are what makes the difference between an array and string formatted as an array. To convert such string to an array, you must get rid of them. And the easiest way to achieve that is the json(…) expression.

Use json(…) expression

You might be tempted to use some combination of replace(…) expressions to remove the extra characters and then split(…) it. But that’s not necessary, you can use a single expression that’ll remove them for you. It’s the json(…) expression that will take a string and convert it to valid json. And as part of the conversion it’ll remove all the escape characters.

json([stringInArrayFormat])

e.g.
json(outputs('Get_response_details')?['body/r4a2197a370d846029b78cdbf87270043'])

The output of this expression will be a valid array.

Power Automate split Forms multiple selection

You can use it as the input of ‘Apply to each’…

Power Automate split Forms multiple selection

…or convert it into a nicer formatted string with the join(…) expression.

Summary

While it might look that Forms gave you an array, it always returns a string. And the easiest way to split the Forms multiple selection response into separate value is to use the Power Automate json(…) expression.

Unless it’s a simple string with a fixed separator where the split(…) expression will do the trick.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

3 thoughts on “Split choices in multiple selection Forms question with Power Automate”

  1. sim1LA says:
    September 21, 2021 at 7:22 pm

    Thank you! This was extremely helpful!

    Reply
  2. Sara says:
    April 4, 2022 at 11:25 am

    If you have something like this [“Name a color”:”Red”,”Favourite food”:”Pancakes”] of type string. Can I convert it somehow to json array? (Basically trying to make an object into an array using your solution but running into errors when adding the json expression)

    Reply
    1. Tom says:
      April 13, 2022 at 2:24 pm

      Hello Sara,
      I don’t think there’s an easy way to convert such string into JSON, it would probably need multiple split(…) and replace(…) expressions to somehow hard-convert it.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


There's also the HTTP requests to SharePoint cheat sheet to help you overcome limitations of some standard actions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

  • How to find Excel rows missing in SharePoint list (Power Automate)March 29, 2023
  • Check whether user exists in AAD with Power AutomateMarch 26, 2023
  • How to highlight whole SharePoint row based on calculated dateMarch 22, 2023
  • Why is your Power Automate flow running so slow?March 19, 2023
  • How to add multiple links to the Power Automate approval taskMarch 15, 2023

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes