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 / Powerapps repeating Ta...
Power Apps
Answered

Powerapps repeating Table- Gallery keeps patching old data

(0) ShareShare
ReportReport
Posted on by

I followed the Shane Young video series on creating repeating table functionality using galleries and collections however I am facing an issue. The problem is that when a users needs to edit the form ,specifically the repeating table section, when the user enters new data and submits, the old and new data are shown on the display form but the old data is showing as duplicated. My questions are 

 

1) IS there a way to update the collection data and not create duplicate old entries?

2) is there a way to delete the old data from the list and replace it with new data?

 

Please let me know if more information is needed. 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    @Anonymous ,

    Can you please advise the Items of the Gallery and the code you are using to update your data source when changes are made. Also  where you are running this from (inside or outside the gallery?)

  • Community Power Platform Member Profile Picture
    on at

    The items that users are filling into the table are rows of text based data and the formula I'm using is 

    ForAll(VerCollection,Patch('VersionInfo-Baseline',Defaults('VersionInfo-Baseline'),{Revision:Veritem1,Date:Veritem2,BaselineOwner:Veritem3,TRMSME:Veritem4,Sections:Veritem5,Changes:Veritem6,BackupOwner:Veritem7,MasterID2:EditForm1.LastSubmit.ID}))

    So the formula is outside of the gallery but it runs on the submission   of the form and patches all the corresponding data to the corresponding column in a SharePoint list. 

  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    @Anonymous ,

    Firstly, how do you collect verCollection as this is what you are Patching (not the gallery directly).

    I also noticed this line at the bottom MasterID2:EditForm1.LastSubmit.ID

    This refers to the last ID you would have submitted using SubmitForm on MasterID2:EditForm1 - when do you do this as you have not mentioned it in your post.

     

     

     

     

  • Community Power Platform Member Profile Picture
    on at

    So for the verCollection the code I'm using is as follows 

    Patch(VerCollection,ThisItem,{Veritem1:ReviInfo.Text,Veritem2:DateInfo.Text,Veritem3:BaseOwn.Text,Veritem4:TrmInfo.Text,Veritem5:SecInfo.Text,Veritem6:ChanInfo.Text,Veritem7:Backup.Text})

     As for the MasterID2:EditForm1.LastSubmit.ID this is how I am tying the information entered to the record so item to allow users to retrieve this info when they look at the record. This is also done when the form is submitted there are more fields that are part of this form then just the gallery.  

  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    @Anonymous ,

    You still did not tell me when you submit the form as this will determine was is the LastSubmit.ID - this is the subject of your post.

    Patch(
     VerCollection,
     ThisItem, 
     {
     Veritem1:ReviInfo.Text,
     Veritem2:DateInfo.Text,
     Veritem3:BaseOwn.Text,
     Veritem4:TrmInfo.Text,
     Veritem5:SecInfo.Text,
     Veritem6:ChanInfo.Text,
     Veritem7:Backup.Text
     }
    )

    The code above will add a new item to the collection each time it is activated. These are then added to your List with this

    ForAll(
     VerCollection,
     Patch(
     'VersionInfo-Baseline',
     Defaults('VersionInfo-Baseline'),
     {
     Revision:Veritem1,
     Date:Veritem2,
     BaselineOwner:Veritem3,
     TRMSME:Veritem4,
     Sections:Veritem5,
     Changes:Veritem6,
     BackupOwner:Veritem7,
     MasterID2:EditForm1.LastSubmit.ID
     }
     )
    )

    and will add all the records that were saved in verCollection. Do you ever clear this collection?

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

  • Community Power Platform Member Profile Picture
    on at

    When a user creates a new record the collection is cleared, the gallery is part of a larger form with multiple fields that need to be filled in. The information is collected and sent to the list when a user hits the submit button. Currently what you have stated is correct the first code saves the data to the collection while the second set of code saves that data to the list. 

  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    OK @Anonymous ,

    Now that we have established that, what exactly is happening that should not be happening?

  • Community Power Platform Member Profile Picture
    on at

    The issue I am facing is when a user updates the gallery all of the data is patched and I need it to only patch new data not the old unchanged data. I'm wondering if there is a way to only patch new data to the collection and not the old data.

  • Verified answer
    WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    @Anonymous ,

    What do you mean by "old data". you said the collection was cleared and then all user input is Patched to the collection and then to the list. Are you saying some of it is existing records? If so, how do you determine this?

  • Community Power Platform Member Profile Picture
    on at

    The user needs to be able to update the collection over a period of time and when they make update the collection is taking the old updates with the new updates. 

     

    I didn't mean to accept as a solution.

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard