cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

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
Highlighted
Community Support
Community Support

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
Highlighted
Super User
Super User

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, "...","")
Highlighted
Community Support
Community Support

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

Highlighted

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!

Highlighted

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

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.

Highlighted

 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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,641)