cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JimmyWork
Level 8

Patching to SharePoint column, getting the latest Text on top

Hi

 

Im using this this patch text into a multinline text column.

 

If(Not(IsBlank(RichTextEditor2.HtmlText)),(Patch(DataSource,
Gallery1.Selected,
{'Case Comments':Gallery1.Selected.'Case Comments' & "<b>" &
Char(13) & Char(13) & User().FullName & "</b>" & "<br> <span style='font-size:12pt'>"& Now()&"</span> " &
Char(13) & RichTextEditor2

}
));
Reset(RichTextEditor2))

 

My issue is that when i do this the text i patch is placed at the bottom. For example i post comment 1 and then i post comment 2 but i want the latest comment to be on top. I tested this on a powerapps form where i use submit form and then the latest comment is placed on top but in a powerapp using patch the latest comment is placed at the bottom. How can i patch so the comments is placed at the top?

 

2019-12-02 15_50_53-Test Design - Saved (Unpublished) - PowerApps.png

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Patching to SharePoint column, getting the latest Text on top

Hi @JimmyWork ,

Do you want to make the new entered comment to displayed at the top within the 'Case Comments' field?

 

Based on the needs that you mentioned, I have made a test on my side, please consider take a try with the following workaround:

1. Please configure your 'Case Comments' field in your SP List as below:

5.JPG

2. Set the OnSelect property of the "Patch" button to following (modify your formula as below: )

 

If(
    !IsBlank(RichTextEditor1.HtmlText),
    Patch(
           '20190701_case7', 
           Gallery1.Selected, 
           {
               Comments:  "<b>" &
Char(13) & Char(13) & User().FullName & "</b>" & "<br> <span style='font-size:12pt'>"& Now()&"</span> " &
Char(13) & RichTextEditor1.HtmlText & Gallery1.Selected.Comments
           }
    )
);
Reset(RichTextEditor1)

 

On your side, you should type the following formula:

 

If(
    !IsBlank(RichTextEditor2.HtmlText),
    Patch(
           DataSource, 
           Gallery1.Selected, 
           {
               'Case Comments':  "<b>" &
Char(13) & Char(13) & User().FullName & "</b>" & "<br> <span style='font-size:12pt'>"& Now()&"</span> " &
Char(13) & RichTextEditor1.HtmlText & Gallery1.Selected.'Case Comments'
           }
    )
);
Reset(RichTextEditor2)

 

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

 

The solution works well as below:

4.JPG

 

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

4 REPLIES 4
Dual Super User
Dual Super User

Re: Patching to SharePoint column, getting the latest Text on top

SharePoint is designed to append text to the bottom of a column automatically if the column is not set to overwrite when updated.  About the only way to add text to the top would be to set the column to overwrite, but read the existing value before patching and then patch with a whole new value that includes the new entry at the top and appends the old entries to the bottom. I don't know any way to tell SharePoint to put the new entry at the top.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Community Support Team
Community Support Team

Re: Patching to SharePoint column, getting the latest Text on top

Hi @JimmyWork ,

Do you want to make the new entered comment to displayed at the top within the 'Case Comments' field?

 

Based on the needs that you mentioned, I have made a test on my side, please consider take a try with the following workaround:

1. Please configure your 'Case Comments' field in your SP List as below:

5.JPG

2. Set the OnSelect property of the "Patch" button to following (modify your formula as below: )

 

If(
    !IsBlank(RichTextEditor1.HtmlText),
    Patch(
           '20190701_case7', 
           Gallery1.Selected, 
           {
               Comments:  "<b>" &
Char(13) & Char(13) & User().FullName & "</b>" & "<br> <span style='font-size:12pt'>"& Now()&"</span> " &
Char(13) & RichTextEditor1.HtmlText & Gallery1.Selected.Comments
           }
    )
);
Reset(RichTextEditor1)

 

On your side, you should type the following formula:

 

If(
    !IsBlank(RichTextEditor2.HtmlText),
    Patch(
           DataSource, 
           Gallery1.Selected, 
           {
               'Case Comments':  "<b>" &
Char(13) & Char(13) & User().FullName & "</b>" & "<br> <span style='font-size:12pt'>"& Now()&"</span> " &
Char(13) & RichTextEditor1.HtmlText & Gallery1.Selected.'Case Comments'
           }
    )
);
Reset(RichTextEditor2)

 

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

 

The solution works well as below:

4.JPG

 

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

JimmyWork
Level 8

Re: Patching to SharePoint column, getting the latest Text on top

@v-xida-msft Thank you so much.

JimmyWork
Level 8

Re: Patching to SharePoint column, getting the latest Text on top

@v-xida-msft May i ask a related question to this.

 

I the code you posted in a save button.
I then have a Label/Text that displays what i save to the column. This displays from a variable.

Set(varSelectedTicket, Gallery1.Selected);

 

How do i update the varSelectedTicket variable with the new input when i save?

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

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