I was creating a simple spinner control for some time values that I am displaying in a gallery and noticed some strange behaviour when patching the collection from within the gallery.
If you patch the item your working on in the gallery using ThisItem as the reference to the record, and there is some processing happening in the background, a new item can be created instead of the current record being patched.
Patch(collection,ThisItem,{Changes: "to patch"})
However, if you patch the item using a LookUp with a referenced Id to ThisItem, and there is some processing happening in the background, it will ignore your click.
Patch(collection,LookUp(collection,Id=ThisItem.Id),{Changes: "to patch"})
I can work around the issue by using the second method but It would be interesting to know what causes the differences in behaviour when the reference is effectively the same.
I have attached an example app that will illustrate.
The app uses the Office365Users data source to talk to an API in the background while you interact with the app.
Hi @SimonMeadows ,
Could you please test as this:
If(!IsBlank(ThisItem),Patch(collection,ThisItem,{Changes: "to patch"}))
Hope this could be helpful.
Best Regards.
Yumia
Hi @v-yuxima-msft ,
Thanks for the suggestion, I tried it and get the same result.
New records are created occasionally instead of updating the current one.
Simon
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
206 | |
187 | |
82 | |
51 | |
37 |
User | Count |
---|---|
288 | |
244 | |
121 | |
76 | |
55 |