cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kgordish
Resolver I
Resolver I

Patch Existing Record

Hello, 

Having Issues Patching existing records in SharePoint. 

 

I have a gallery named: ExcelGallery
Items: SortByColumns(Filter(Gateways, MasterID = ProgramGallery.Selected.ID),"Date")

kgordish_0-1655747748890.png

Have a hidden toggle to detect changes
Defaults:
ThisItem.'Year' <> YearInput.Text ||
ThisItem.'Field' <> FieldInput.Text ||

 

Patch Formula:
ForAll(Filter(ExcelGallery.AllItems, Toggle1.Value = true),
Patch(Gateways, ThisRecord, {'Year': YearInput.Text}));
Navigate(Home)

 

Saving to SharePoint and Currently Title field is not being used/required.
Don't know why data is not getting updated. Is there an issue with using ThisRecord?

 

Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Ah, it makes a difference if controls such as VPPDateInput are located within the gallery. In that case, try revising your code as shown to capture the separate values in each gallery item:

ForAll(
    Filter(ExcelGallery.AllItems, Toggle1.Value = true) As aRecord,
    Patch(Gateways, aRecord, 
    {
        ModelYear: MYInput.Text,
        Program: ProgramInput.Text,
        Ref_Only_Drop: {Value: RefOnlyInput.Selected.Value},
        VPPDate: aRecord.VPPDateInput.SelectedDate
    })
);

You may also want to similarly edit the control references for MYInput, ProgramInput, and RefOnlyInput if those are also located within the gallery.

 

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

5 REPLIES 5
BCLS776
Super User
Super User

A ForAll()-Patch() combination needs an As operator to help resolve ambiguity:

ForAll(Filter(ExcelGallery.AllItems, Toggle1.Value = true) As aRecord,
Patch(Gateways, aRecord, {'Year': YearInput.Text}));
Navigate(Home)

Hope that helps,

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
kgordish
Resolver I
Resolver I

@BCLS776 Thanks Bryan. Wish I could buy you a cold beverage or send a tip. Thanks. 

kgordish
Resolver I
Resolver I

@BCLS776  This patch seems to be treat different lines of data as the same. If I make multiple date

ForAll(Filter(ExcelGallery.AllItems, Toggle1.Value = true) As aRecord,
Patch(Gateways, aRecord, {ModelYear: MYInput.Text,
Program: ProgramInput.Text,
Ref_Only_Drop: {Value: RefOnlyInput.Selected.Value},
VPPDate: VPPDateInput.SelectedDate}));
Navigate(Home);
Refresh(Gateways)

 

Before: 

kgordish_0-1655818828170.png

Change Dates to 28, 29, and 30. Saves all three dates as 30.  Any advice on how to avoid this situation? 

kgordish_2-1655818961884.png

 

Ah, it makes a difference if controls such as VPPDateInput are located within the gallery. In that case, try revising your code as shown to capture the separate values in each gallery item:

ForAll(
    Filter(ExcelGallery.AllItems, Toggle1.Value = true) As aRecord,
    Patch(Gateways, aRecord, 
    {
        ModelYear: MYInput.Text,
        Program: ProgramInput.Text,
        Ref_Only_Drop: {Value: RefOnlyInput.Selected.Value},
        VPPDate: aRecord.VPPDateInput.SelectedDate
    })
);

You may also want to similarly edit the control references for MYInput, ProgramInput, and RefOnlyInput if those are also located within the gallery.

 

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
kgordish
Resolver I
Resolver I

That worked. Thank you.

 

ForAll(Filter(ExcelGallery.AllItems, Toggle1.Value = true) As aRecord,
Patch(Gateways, aRecord, {'Model Year': aRecord.MYInput.Text,
Program: aRecord.ProgramInput.Text,
Reference_Only: {Value: RefOnlyInput.Selected.Value},
'VPP Dates': aRecord.VPPDateInput.SelectedDate}));
Navigate(Home);
Refresh(Gateways)

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (2,522)