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 / Synchronizing Collecti...
Power Apps
Answered

Synchronizing Collection and Datatable

(0) ShareShare
ReportReport
Posted on by 18

I have an app for an offline solution. In there is a button which download "OnSelect" certain data from a data table (Excel) with:

 

ClearCollect(Stammdaten;Search(Tabelle11;Suchfeld.Text;"ProjektNr"))

 

This works perfectly. Now after making some changes in the collection, it should patch/override certain data in the datatable with the collection data.

 

So far I use:

 

Patch(Tabelle11;Stammdaten)

 

Problem is: If I delete an item in the collection, it should also be deleted in the datatable. So what I basicly want, is to delete certain data in the datatable and replace the deleted dataset through the collection data.

 

Looking forward to hearing from you.

 

Sincerly Vinc92

Categories:
  • BCBuizer Profile Picture
    22,854 Super User 2026 Season 2 on at

    Hi @Vinc92 ,

     

    You'll have to create a second collection that tracks the ID of the deleted items in your collection (colDeleted).

     

    In addition to your Patch, you'll have to add some code to run through the items in colDeleted and remove the corresponding items in Tabelle11.

  • Vinc92 Profile Picture
    18 on at

    hi @BCBuizer,

     

    thanks a lot.

     

    How do you get the ID of the rows from a connected Excel file? In sharepoint it seem easy. 

  • BCBuizer Profile Picture
    22,854 Super User 2026 Season 2 on at

    Hi @Vinc92 ,

     

    When connecting to an Excel for Business data source, you indicate which column holds the identifies or have an auto generated column:

     

    BCBuizer_0-1648124513526.png

    Whatever option you chose when connecting, will be the column you need to track when deleting items.

  • Vinc92 Profile Picture
    18 on at

    Alright and how u track the ID in the collection? Because if I connect the excel table to powerpoint, I cant get the value of the ID (at least I dont see a a way). Thanks for having patience.

  • Verified answer
    BCBuizer Profile Picture
    22,854 Super User 2026 Season 2 on at

    Hi @Vinc92 ,

     

    I ran a quick test and the ID isn't all that important.

     

    When removing an item from you list, make sure to first add it to colDeleted to save the entire record.

     

     

     

    Collect(colDeleted; *******);;
    Remove(Stammdaten; *******)

     

     

     

    To the code for your "sync" button, you need to then make sure to add the part that removes the records in colDeleted from your data source and finally clear colDeleted:

     

     

     

    Patch(Tabelle11;Stammdaten);;
    ForAll(colDeleted;Remove(Tabelle11;colDeleted));;
    Clear(colDeleted)

     

     

     

     

  • Vinc92 Profile Picture
    18 on at

    Works perfect. Thx a lot.

  • Vinc92 Profile Picture
    18 on at

    @BCBuizer 

     

    Hello,

     

    I would like to ask for help with the remove function. If I wanna delete multiple items in the "DelCollection" from the table, he give me an error that he couldn't find the row with PowerAppID. If I just delete on Item, it works.

     

    Do you have an idea, how he can delete even more items?

     

    Sincerly Vincent

  • BCBuizer Profile Picture
    22,854 Super User 2026 Season 2 on at

    Hi @Vinc92 ,

     

    Can you please open a new topic for that issue?

  • Vinc92 Profile Picture
    18 on at

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 397 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard