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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Data not updating from...
Power Apps
Answered

Data not updating from edit in Gallery

(0) ShareShare
ReportReport
Posted on by 40

Hi There,

 

First off I am a novice to all of this so please bare with me. 

 

I have created a gallery with a edit button, when I click on this the fields become "Editable" and I make my changes to the record. When I click on my save button this writes to my spreadsheet connection but as a new entry instead of updating the existing entry. I have watched a lot of videos to piece this together. Here is my formula:


UpdateContext({EditRecord: " "});Patch('Member Tracker',{Membership_x0020_Number:ThisItem.Membership_x0020_Number},
{Member_x0020_Name: MembersNameInputField.Text,
Membership_x0020_Number: MembershipNumberInputField.Text,
Membership_x0020_Type:MembershipTypeInputField.Text,
Member_x0020_Status:MemberStatusInputField.Text,
Payment_x0020_Date:PaymentDateInputField.Text,
Email_x0020_Address:EmailAddressInputField.Text,
Mobile_x0020_Number:ContactNumberInputField.Text,
Notes:NotesInputField.Text})

 

Any help you can provide would be great!

Thank you

 

Screenshot_1.png
Categories:
  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at
    Can you try this version of Patch?

    UpdateContext({EditRecord: " "});Patch('Member Tracker', ThisItem,
    {Member_x0020_Name: MembersNameInputField.Text,
    Membership_x0020_Number: MembershipNumberInputField.Text,
    Membership_x0020_Type:MembershipTypeInputField.Text,
    Member_x0020_Status:MemberStatusInputField.Text,
    Payment_x0020_Date:PaymentDateInputField.Text,
    Email_x0020_Address:EmailAddressInputField.Text,
    Mobile_x0020_Number:ContactNumberInputField.Text,
    Notes:NotesInputField.Text})

    ---
    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

    Hardit(Haman)
  • Verified answer
    mdevaney Profile Picture
    29,993 Moderator on at

    @mrjrobinson 

    Hello there and welcome to the PowerApps community.  I can see the reason why your PATCH is not updating the current record as you expected.  It is because of this code segement in the 2nd argument of PATCH.

     

    {Membership_x0020_Number:ThisItem.Membership_x0020_Number}

     

    The 2nd argument of PATCH references the record to be updated.  What you have done is created a whole new record by putting some data between the curly brackets { }.  Instead what you should do is replace it with this code.

     

    ThisItem

      

    ThisItem returns the current record in the gallery the Save button is placed within and it is a record data type.  If you are familar with LookUp it achieves the same result current record like this.

     

    LookUp('Member Tracker',ID=ThisItem.ID)

     

    To recap, here's the full code you should use.

     

    UpdateContext({EditRecord: " "});
    Patch(
     'Member Tracker',
     ThisItem,
     {
     Member_x0020_Name: MembersNameInputField.Text,
     Membership_x0020_Number: MembershipNumberInputField.Text,
     Membership_x0020_Type:MembershipTypeInputField.Text,
     Member_x0020_Status:MemberStatusInputField.Text,
     Payment_x0020_Date:PaymentDateInputField.Text,
     Email_x0020_Address:EmailAddressInputField.Text,
     Mobile_x0020_Number:ContactNumberInputField.Text,
     Notes:NotesInputField.Text
     }
    );

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at
    @mdevaney would appreciate acknowledgement if someone posts the same suggested solution before you 🙂

    No hard feelings, just a suggestion. Hope you have a great day!
  • mdevaney Profile Picture
    29,993 Moderator on at

    @PowerAddict 

    Sometimes we are posting at the same time so it happens.  I typically open the reply window, go to my app testing environment to build a test and then post a response.  But yes, I do acknowledge that you also have a correct solution here.

  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at
    Yup, has happened to me before. No worries!
  • mrjrobinson Profile Picture
    40 on at

    Thank you very much for your assistance!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard