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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Removing carriage return
Power Automate
Answered

Removing carriage return

(0) ShareShare
ReportReport
Posted on by 96

Hello All,

 

I have created a flow which reads the content of a .qid file but I have a carriage return on each row "\r" 

 

How can I remove the "\r" on each row:

I have tried by using the following expression: 

replace(replace(outputs('Compose_3'),'\r',''),'n','')

But It did not work. The error that I am facing after applying the above expression is:
 
autoperfect93_1-1698002083429.png

 

Thanks in advance for any help or advice.

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    69,117 Most Valuable Professional on at

    The main problem is that your Compose is an array.  That's where the error is coming from.  try the following to turn the array into a string and then remove the '\r'.

     

    replace(replace(join(outputs('Compose_3'),' '),'\r',''),'\n','')

    Once you use Join to turn it into an array I also don't think you'll have any \n

     

  • grantjenkins Profile Picture
    11,063 Moderator on at

    I'm not sure what you are doing with the preceding Compose actions to build your array - might be worth looking at those to see if we can simplify it for you.

     

    If you wanted to start with your Compose 3 then I'd use a Select to remove the carriage returns, then use a Filter array to remove any empty strings.

     

    Note that I've just added the array data directly into Compose 3 for this example as don't know how you are getting your data in there.

    grantjenkins_6-1698015790278.png

     

    Select uses the output from the Compose 3 (your array) and the following expression to remove any carriage returns.

    replace(item(), decodeUriComponent('%0D'), '')

     

    Filter array uses the output from the Select and the following expression to remove any empty rows.

    trim(item())

     

    And the final output from the Filter array based on my array data would be:

    grantjenkins_5-1698015698184.png

  • autoperfect93 Profile Picture
    96 on at

    Hello @grantjenkins , @Pstork1 ,

     

    Thank you for the help!

     

    I have managed to remove the "\r" carriage return via filter array step. Now my next step is to split the result in "Filter Array 2" step but I have the below error message:

     

    autoperfect93_0-1698044871570.png

     

    As you can see the Filter array 2 step has successfully removed the carriage returns. In Compose 6 I am trying to split the output from Filter array 2 via this expression:

     

    autoperfect93_1-1698045021303.png

     

    But I face the error message:

     

    autoperfect93_2-1698045061388.png

    Unable to process template language expressions in action 'Compose_6' inputs at line '0' and column '0': 'The template language function 'split' expects two parameters: the string to split as the first parameter, the separator as the second parameter. The function was invoked with '1' parameter(s).

     

    I am using the split function because I want to split the output of Filter array 2 on separate substrings.

    After splitting each row of the text string I am doing a lookup in a excel table and replace one line in the text file.

     

     

  • Pstork1 Profile Picture
    69,117 Most Valuable Professional on at

    As I mentioned in my previous post, the output you are working with is an array not a string. You can't split an array because its already an array. Based on the screenshot above what are you trying to get as output?  Then we can help show you the right syntax.

  • grantjenkins Profile Picture
    11,063 Moderator on at

    Just confirming - is this related to the question here:
    https://powerusers.microsoft.com/t5/Building-Flows/Filtering-data-from-excel-table/m-p/2424468

  • autoperfect93 Profile Picture
    96 on at

    Hello @grantjenkins@Pstork1 ,

     

    Yes this topic is related to the one you mentioned. Let me clarify. At first the main goal was to amend "Cparty" field inside .QID files but the files included only 1 FX deal.

     

    Now the users want to do the same amendment but for 2 or more deals inside a single .QID file.

     

    Here is a word file with detailed explanation of what is currently achieved and what the users need.

     

    I have attached a word document where I have explained the current situation.

  • Verified answer
    Chriddle Profile Picture
    8,672 Super User 2026 Season 1 on at

    A general example how you can handle this:

    Chriddle_2-1698665442118.png

     

    Filter for empty items:

    @not(or(empty(item()), equals(item(), '\r')))

     

    Create an array of objects

    Select From:

    @{body('Filter_array')}

     

    Map prop:

    trim(first(split(item(), '=')))

    Map val:

    trim(
    	replace(
    		last(
    			split(item(), '=')
    		),
    		'/r',
    		''
    	)
    )

     

    Filter this array for the desired prop

    From: @body('Select')

    Filter: @equals(item()['prop'], 'ticket_no')

     

    Finally, check whether the prop exists in the array and return the value if so:

    if(
    	greater(
    		length(body('Filter_array_2')),
    		0
    	),
    	first(body('Filter_array_2'))['val'],
    	null
    )

     

     

  • autoperfect93 Profile Picture
    96 on at

    Hi @Chriddle ,

    Thanks for the solution. I will close this topic now as I already managed to tackle this issue.

     

    Currently I have opened another Topic which is for another issue that I face:

     

    https://powerusers.microsoft.com/t5/Building-Flows/Filtering-data-from-excel-table/m-p/2424192#M270568

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 557

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 264 Super User 2026 Season 1

Last 30 days Overall leaderboard