web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch Not Overwriting ...
Power Apps
Unanswered

Patch Not Overwriting Existing SP List Data

(0) ShareShare
ReportReport
Posted on by

I've got the following in a button. The desire is to have the Patch overwrite the fields displayed on the MemberList and included in the Patch.

 

What the below accomplished was to create a new record, and not simply overwrite the old record.

The item overwritten should be based on the Member's 'UnqID'; the number of which is included in the Patch and in the 'Title' column of the MemberList. 

 

Patch(MemberList,Defaults(MemberList),
{Park:UpdateFormParkDropdown.SelectedText.Park,
NPSReg:UpdateFormNPSRegFld.Text,
DOIReg:Value(UpdateFormDOIRegFld.Text),
UnqID:UpdateFormEngCoParkFld.Text,
SteNmNo:UpdateFormSteNmNoFld.Text,
FrstNm:UpdateFormFirstNmFld.Text,
LstNm:UpdateFormLastNmFld.Text,
MI:UpdateFormMIFld.Text,
FullNm:UpdateFormFullNmFld.Text,
UsrNm:UpdateFormUserNmFld.Text,
MemberEmail:UpdateFormMemberEmailFld.Text,
ECMem:UpdateFormEngCoMemFld.Text,
ActveECMem:UpdateFormActiveECMemberFld.Text,
ProgramHierarchy:UpdateFormProgramHierarchyFld.Text});

 

UpdateContext({UnqIDFldVisible: false});

 

Navigate(SnapShotScrn,ScreenTransition.Cover);

Categories:
I have the same question (0)
  • Verified answer
    Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    When using patch the second parameter is either defaults(data source), when creating a new record, or something like a lookup() to identify an existing record.  Since it uses defaults() the above patch will always create a new record.

  • Community Power Platform Member Profile Picture
    on at

    Would the default data source then be the Gallery or Form in which the updated fields are located? 

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    The defaults clause says to use the default values in the data source to create a new record. It has nothing to do with the default data source.  The data source is specified in the first parameter.  As I said, to update a record you need to identify which specific record needs to be updated in the second clause.  That's commonly done with a Lookup() 

  • Community Power Platform Member Profile Picture
    on at

    Yes, sir. Thank you for the clarification.

     

    Do you have any suggestions on how the Lookup( ) should be formatted in my case?

     

    I'm no expert and am in need of assistance, please.

     

         Patch(MemberList,Defaults(MemberList),
                  Lookup(........
                              {Park: UpdateFormParkDropdown.SelectedText.Park,

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    That depends on what field you have available when doing the patch that uniquely identifies the record you want patched.  Assuming its the UnqID field it would look like this.

    Lookup(MemberList, UnqID = UpdateFormEngCoParkFld.Text)

     

  • Verified answer
    Community Power Platform Member Profile Picture
    on at

    My first try; Power Apps didn't like it. What did I do wrong? 

     

    3csman_0-1612885646879.png

     

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    What is the error message when you hover over the formula?  I don't see anything particularly wrong with the syntax.

  • Community Power Platform Member Profile Picture
    on at

    You are right, sir. I'm not sure what happens; maybe to much going on.

     

    I cut it out and put it back; no errors.

     

    Now, let's assume I have a screen another screen with a button for a 'New' Patch of a new record. How would I update the following to achieve that?

     

    Patch( NewMemberApprovalList,
    Defaults( MemberList, UnqID=NewMemberGalleryUniqueIDFld.Text),
    { UnqID: NewMemberGalleryUniqueIDFld.Text,
    SteNmNo: NewMemberGallerySiteNameNoFld.Text,

     

    3csman_0-1612891598451.png

     

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    If by New patch of a new record you mean creating a new record then is should be just like the other patch, but with defaults(Memberlist) as the second parameter.  You are creating a new record so you don't need to identify a specific record, just the data source.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard