Power Automate notes

Posted by John Liu on Tuesday, March 26, 2024

Add newline to string variable using concat

There are several ways to Add a newline when appending to string variable:

  1. Add ‘Enter’ into the expression. concat(‘Line1’,’ ‘,‘Line2’,’ ‘,‘Line3’ )
  2. Create a ‘NewLine’ variable and in the ‘Value’ field press Enter to assign line return to it. Use this variable in the concatenation.
  3. Use decodeUriComponent(‘%0A’) expression concat(‘Line1’,decodeUriComponent(’%0A’),‘Line2’,decodeUriComponent(’%0A’),‘Line3’)

Remove newline from string

There seems no easy way to remove newline/line break from multiline string. One solution is to convert the string to printable character using uriComponet function. The newline will be shown as %0A. We then use replace to remove the %0A and convert the the string back to normal string.

uriComponetToString(replace(uriComponent(yourstring), '%0A', ''))

Single quote

If you require to preserve/escape single quote in a string, replace single quote with two single quotes.