I have a collection (created from Sharepoint list) and I would like to overwrite the original SP list by this collection. This overwrite should be activated by an exit button after asking if I would like to exit the app.
This is the code I used in the PowerApps:
ForAll(collection; Patch(Leltár_SP_lista; Defaults(Leltár_SP_lista); { 'T$ORNO': orno; 'T$SERN': sern; 'T$CWAR': cwar;'T$LOCA':loca;'T$CPRJ': cprj; 'T$ITEM':item;'T$CNTR': cntr;'T$CLOT':clot;'T$DATE':date;'T$STUN':stun;'T$QSTK':qstk;'T$QSTR':qstr;'T$DATA':data; 'T$TIMA':tima;'T$CSTK': cstk;'T$CSTR':cstr;'T$COUN':coun;'T$PRST': prst;'T$CSTS':csts;'T$DSCA':dsca}))
The main problem is that the pressing of button (which activate this code) doesn't overwrite the Sharepoint list but merges to end of the list.
How should I modify this code to solve my problem?
When you use Defaults() function you create a new record. If you want to overwrite the record you have to refer to the ID with a LookUp function inside the Patch as the second argument. Or you could use a ForAll function with a Remove function before patching. Please tell me if you have problems on doing this