cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sajarac
Super User
Super User

Append Text for a Gallery Lookup

Hi there.

I am looking for some help here:

I am trying to append text to a multi line column in my share point list.

 

The List name = NotesComments

I have that list as a datasource in my gallery with a Lookup formula:

Sort(Split(LookUp(NotesComments, Title =varRecord.Title).Notes, "***"),Result,Descending)

 

Also, I have a RichTextEditor1

 

And to Patch the values in my SPL I have a button with the onselect=

Patch(NotesComments, Gallery3.Selected, {Notes:Gallery3.Selected.Notes & "***" & CurrentUserName.FullName & " - " & Now() & ":<br>" & RichTextEditor1.HtmlText}); Reset(RichTextEditor1)

 

In my Gallery 3 I have a HTMLText = ThisItem.Result

 

I would like to see the notes separated in my Gallery even if they are in a single cell in my column. that's why the Split Function.

 

But the Patch function is not working because the specific column Result" does not exist.

 

Could someone please point me in the right direction?

 

Thanks in advance

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ramon031
Frequent Visitor

A little bit of a stratch but does it help if you build the formula like this:

Patch(NotesComments,LookUp(NotesComments,Title = varRecord.Title), {Notes:LookUp(NotesComments,Title = varRecord.Title,Notes)  & CurrentUserName.FullName & " - " & Now() & ":
" & RichTextEditor1.HtmlText& "***"}); Reset(RichTextEditor1)

Cause the split function sees the delimeter at the start of your tekst, and your tekst looks like: *** Note1 *** Note2 *** Note 3.

 

With above formula the reuslt should be: Note1 *** Note2 *** Note 3 ***

View solution in original post

8 REPLIES 8
v-xiaochen-msft
Community Support
Community Support

Hi @sajarac ,

 

The root cause is that the second parameter of patch function is wrong.

vxiaochenmsft_0-1657171321481.png

The second parameter of the patch function requires the updated record in your NotesComments list.

Obviously, the record selected by gallery is not the record that exists in NotesComments list.

 

So , you could use lookup function instead of Gallery3.Selected here.

Something like this:

Patch(NotesComments, LooUp(NotesComments,<your column> = Gallery3.Selected.<column name>), {Notes:Gallery3.Selected.Notes & "***" & CurrentUserName.FullName & " - " & Now() & ":<br>" & RichTextEditor1.HtmlText}); Reset(RichTextEditor1)

 

Best Regards,

Wearsky

Ramon031
Frequent Visitor

The second part of your formula refers to the result collumn of the Split function. So your Onselect button should be something like:

 

 

 

Patch(NotesComments,LookUp(NotesComments,ID = varRecord.ID), {Notes:Gallery3.Selected.Notes & "***" & CurrentUserName.FullName & " - " & Now() & ":
" & RichTextEditor1.HtmlText}); Reset(RichTextEditor1)

This is assuming that the varRecord variable has the SharePoint list as it source.

 

sajarac
Super User
Super User

Good morning and thank you very much both @Ramon031 and @v-xiaochen-msft . 

I have tried your solution and for some reason the formula still complaining. Now I am able to patch My NotesComments Share point list but it only keeps the last two notes.

 

This is what I have:

 

sajarac_0-1657194613985.png

 

Ramon031
Frequent Visitor

With gallery3.selected it selects only one record in the patch next to the new one. So what happens when tou try this:

 

Patch(NotesComments,LookUp(NotesComments,Title = varRecord.Title), {Notes:varRecord.Notes & "***" & CurrentUserName.FullName & " - " & Now() & ":
" & RichTextEditor1.HtmlText}); Reset(RichTextEditor1)

This way you have the notes collumn in a property. 

sajarac
Super User
Super User

sajarac_0-1657196790578.png

 

Error =  Name is not valid. 'Notes' isn't recognized.

Ramon031
Frequent Visitor

I assumed that your varRecord had all of the properties form you list. 

then we need a little workaround:

Patch(NotesComments,LookUp(NotesComments,Title = varRecord.Title), {Notes:LookUp(NotesComments,Title = varRecord.Title,Notes) & "***" & CurrentUserName.FullName & " - " & Now() & ":
" & RichTextEditor1.HtmlText}); Reset(RichTextEditor1)

 

sajarac
Super User
Super User

GREAT!!!!!

Thank you very much. I will never figure out that formula by myself. And I still don't get it but it's working now.

 

Last question?

 

I noticed an empty row at the end for. Is there a way to remove it?

 

If not. Now worries I am happy with the solution.

 

sajarac_1-1657200206837.png

 

sajarac_2-1657200224779.png

 

Thanks again!

 

🙂

 

 

Ramon031
Frequent Visitor

A little bit of a stratch but does it help if you build the formula like this:

Patch(NotesComments,LookUp(NotesComments,Title = varRecord.Title), {Notes:LookUp(NotesComments,Title = varRecord.Title,Notes)  & CurrentUserName.FullName & " - " & Now() & ":
" & RichTextEditor1.HtmlText& "***"}); Reset(RichTextEditor1)

Cause the split function sees the delimeter at the start of your tekst, and your tekst looks like: *** Note1 *** Note2 *** Note 3.

 

With above formula the reuslt should be: Note1 *** Note2 *** Note 3 ***

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (3,308)