cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JohnYuma
Level: Powered On

Removing hard returns and limiting characters in label control?

I have a flow that creates a new item in a SharePoint list from an incoming email.  In my app I have a flexible height gallery with a label control tied to the Body Preview field in this same SharePoint list.  In this label I would like to:

 

  • Remove the carriage returns (hard returns)
  • Limit the amount of characters (say, to 144)
  • have an ellipses ( . . . ) at the end of the 144 characters

Any help would be greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Removing hard returns and limiting characters in label control?

Hi @JohnYuma ,

I have made a test on my side, please take a try with the following workaround:12.JPG

Set the Text property of the Label control within your Gallery to following:

Left(Substitute(ThisItem.'Body Preview',"
",""),144) & If(Len(Substitute(ThisItem.'Body Preview',"
",""))>144,"...","")

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Super User
Super User

Re: Removing hard returns and limiting characters in label control?

To remove carriage returns:

Substitute(Label1.Text,"
","")

(In this case I set Label1.Text to some sample text with carriage returns - just use the field/control that has your text data). Note that there is a carriage return in the between the first and second " (use Shift+Return in the formula bar to type this).

To limit to 144 characters, use the Left function.

You can use the concatenate funtion (or just the & character) to add the "...". You may want to use the Len function so that you are only adding the ... if there are more than 144 characters.

So you would end up with something like this:

Left(Substitute(Label1.Text,"
"," "),144) & If(Len(Substitute(Label1.Text,"
"," "))>=144, "...","")
Community Support Team
Community Support Team

Re: Removing hard returns and limiting characters in label control?

Hi @JohnYuma ,

I have made a test on my side, please take a try with the following workaround:12.JPG

Set the Text property of the Label control within your Gallery to following:

Left(Substitute(ThisItem.'Body Preview',"
",""),144) & If(Len(Substitute(ThisItem.'Body Preview',"
",""))>144,"...","")

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

JohnYuma
Level: Powered On

Re: Removing hard returns and limiting characters in label control?

Kris,

 

This worked perfectly, thanks so much.  Could I trouble you for guidance in my next step in regard to this formula?  I added a label (within this label) by editing your formula as follows:

 

"Request:" & " " & Left(Substitute(ThisItem.BodyPreview,"
",""),144) & If(Len(Substitute(ThisItem.BodyPreview,"
",""))>144,"...","")

 

This gives me the format that I want now:

 

OPUS Pic2.png

 

Would you happen to know if there is coding that I can add that will make the text I added at the beginning ("Request:") be red in color?  Can I add some tags of some sort to do this?

 

Thanks in advance!

Super User
Super User

Re: Removing hard returns and limiting characters in label control?

If you want formatting within the text, try looking at the HTML text control. You just need to wrap the relevant html tags around the text you want to apply formatting to.

Highlighted
JohnYuma
Level: Powered On

Re: Removing hard returns and limiting characters in label control?

Paul,

 

Thanks for your reply; I did try that multiple ways and still seem to be coming up with errors.  Simple code for this would be:

 

<font color="red">"Request:"</font> & "  " & Left(Substitute(ThisItem.BodyPreview,"
",""),137) & If(Len(Substitute(ThisItem.BodyPreview,"
",""))>137,"...","")

 

I have tried variations of different the HTML coding and even Excel coding such as:

 

Font.Color = RGBA(184, 0, 0, 1)

 

I just can't quite hit the right combination.

Super User
Super User

Re: Removing hard returns and limiting characters in label control?

 I think you may have to put some additonal coding around it, e.g.

<!DOCTYPE html>
<html>
<head>
</head>
<body>

<font color="red">"Request:"</font> ...

</body>
</html>

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,036)