web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Replacing carriage ret...
Power Apps
Answered

Replacing carriage return and line break in a string

(0) ShareShare
ReportReport
Posted on by

I am pulling in a field from a database table through a SQL Server connection that contains all the fields that populate a dropdown - they are separated by a carriage return and a line feed.

 

My hope is if there is a way to translate a SQL statement like REPLACE(REPLACE(field, CHAR(10), '*'), CHAR(13), '*) which would change them into ** between the dropdown items and then do a split function in PowerApps to get a table of the items to go into the dropdown.

 

I am coming at a loss on how to approach and accomplish however...

Categories:
I have the same question (0)
  • Verified answer
    Meneghino Profile Picture
    6,949 on at

    Start looking at this:

    https://docs.microsoft.com/en-us/powerapps/functions/function-split

     

    May work with Char(13) and/or Char(10) as separator

  • Community Power Platform Member Profile Picture
    on at

    Thank you, I saw the split part, but wasn't sure if PowerApps recognized line feeds and carriage returns - didn't think to look up if the same Char function existed..... again thanks!

  • degvalentine Profile Picture
    195 on at

    Here's a solution without using a separate variable, but is a bit uglier. Depending on your situation, might be better.

    1. encode the content
    2. replace newline with a new delimiter
    3. decode the content
    4. split on the new delimiter

    In the example, I use "outputs('Compose')" as the content you want to split and a tilde as the new delimiter.

    split(
     decodeUriComponent(
     replace(
     encodeUriComponent(outputs('Compose')),
     '%0A',
     encodeUriComponent('`')
     )
     ),
     '`'
    )

    You can find do this with windows-style newlines (CRLF), too: "%0D%0A". Here's a link to the W3 School's table of url-encoded values.

     

    Edit: just noticed @FlowNick found this same solution a long time ago.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard