ls_Laptop is a sharepoint list and CacheLaptop is a collection
I want the record to be updated once i submit the form
I created a button onselect = submit(Form1)
Form1 onsuccess = ClearCollect(CachedLaptop,Patch(ls_Laptop,CachedLaptop))
But this always show error conflict, actually i just want to update the selected or the modify record to the sharepoint list and also the collection.
any idea? Thanks
Solved! Go to Solution.
Why don't you simply update the collection after the update? the conflict might be because your saving the data through the form and Patch is also saving the same data.
There might be another option if you only use Patch as it returns the updated record when you use it:
"The return value of Patch is the record that you modified or created. If you created a record, the return value may include properties that the data source generated automatically."
Actually due to performance issue, i loaded the sharepoint list into collection onstart, i dont know whether is this the correct way.
even my form data are from collection
do you mind to give an example on this? i try many ways, maybe i just misunderstood or how the patch work.
Keep in mind that the OnStart method is having some issues at the moment.
About Patch, you could see this video from @Shanescows that explains it very well:
About loading the list into a collection, it depends on what you're trying to do and the size of this list.
Could you please share a bit more about the error message that you mentioned?
Do you want to update the modified record into the collection (CacheLaptop) when the modified record is submitted into your SP list?
If you want to update the modified record into the collection (CacheLaptop) when the modified record is submitted into your SP list, I think it is not necessary to use the Patch function.
I have made a test on my side, please take a try with the following workaround:
Set the OnStart property of the first screen to following formula:
Note: The '20180622_case1' represents the SP list data source within my app.
On your side, it is:
Within Edit Screen, set the OnSelect property of the Submit button (Button control) to following formula:
Set the OnSuccess property of the Edit Form control (Form1) to following formula:
On your side, it is:
In addition, if you want to update the modified record into the Collection (CachedLaptop), you could also take a try to set the OnSuccess property of the Edit Form control (Form1) to following formula:
More details about the UpdateIf function in PowerApps, please check the following article:
One addition to the post off v-xida-msft, who explaines very well how to address this question. You should think what you're triïng to achieve by collection in this way instead off just connecting to your datasource?
The main problem in your approach is that at a specific moment in time you will run into a limitation issue related to the max nummer off records you can store in a collection. Default this limitation is 500 (you can max set it to 2000 in the advance menu) so when you hit this number off records the ClearCollect() will not contain your new update records, simple because only the first number off records are imported.
If you want to use the collection then at least add a condition to it to be sure the new records are loaded. For example a
SortByColumns(datasource, Createdate, Descending)
@v-xida-msft Hi Kris, I used this method before and it intermitently gave me ETAG Mismatch error as screenshot below, that why i'm trying patch, but seem like i facing the same issue also, can't find out what wrong with that.
@KroonOfficeSol the reason why I used collection instead sharepoint list directly
1) If get sharepoint list directly, the gallery take time to load even with few records, not to talk about 1k records, of cause I will filter with some condition to get it less records, but just the screen with gallery can load faster if i get from collection instead of direct sharepoint list
2) it effect the smoothness on mobile while using powerapps, I try on a mid range phone, I can't expect everyone get an iPhoneX for this.
oh god, you save me! that was really issue due to microsoft flow, i have a flow that auto update field if modified, so what i do is disable the field to be submit from powerapps and it work! thank you so much.
Check it out!
Check it out!
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Features releasing from October 2019 through March 2020
The largest Power BI, Power Platform, and Data conference in New Zealand