cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jasonmurphy
Helper I
Helper I

Removing unwanted character output from MS Forms

Hi All,

 

I've found some solutions on this forum to replace unwanted characters from MS Forms, but am not getting far with removing the \n characters that get appended to multiple choice responses in MS Forms.

 

Here are some of the other posts that have helped me reach this point:

 

Here is a picture of my flow:

Screen Shot 2021-11-25 at 9.51.52 am.png

 

The compose function is using this expression:

 

 

 

replace(body('Get_response_details')?['re161b12e16c941ba887a822bf85f74d3'],'\n','')

 

 

 

 

I have also tried using the expression directly within the SharePoint update list item connector. In all cases, the replace function is simply ignored and the output is:

 

"Option1\n"

"Option2\n"

Etc...

 

This is a real dealbreaker because the data is being inserted into a SharePoint List calculated column and results in a line break, which breaks the calculated column formula.

 

Any help would be greatly appreciated.

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
fchopo
Super User
Super User

Hi @jasonmurphy 

Could you try this?:

uriComponentToString(replace(uriComponent(body('Get_response_details')?['re161b12e16c941ba887a822bf85f74d3']), '%0A', ''))

The UriComponent function returns an uncoded version for a string and replace unsafe characters with escape characters ('%0A' is line break one). The UriComponentToString encodes again the string.

 

Hope it helps!

Ferran

 

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

View solution in original post

4 REPLIES 4
fchopo
Super User
Super User

Hi @jasonmurphy 

Could you try this?:

uriComponentToString(replace(uriComponent(body('Get_response_details')?['re161b12e16c941ba887a822bf85f74d3']), '%0A', ''))

The UriComponent function returns an uncoded version for a string and replace unsafe characters with escape characters ('%0A' is line break one). The UriComponentToString encodes again the string.

 

Hope it helps!

Ferran

 

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
jasonmurphy
Helper I
Helper I

Thank you @fchopo. It worked! Really appreciate it. 🙂

tn101
Frequent Visitor

Hi @fchopo ,

Please help me....

How can I use line break in Join action with the below statement

json(body('Get_response_details')?['r7cca81fce18242709b9857d74952ae93'])
 
tn101_0-1652321969998.png

 

...

I want to display the multiple values in email:

  • Banner1
  • Banner2
  • Banner3

instead of 

Banner1, Banner2, Banner3

 

fchopo
Super User
Super User

Hi @tn101 

Create a string variable with a line break and use it in the join action.

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (2,521)