Hi all,
I'm quite average at building powerapps, but one function that gets me a lot of the time is the patch function. I cant seem to get the following too work, and i've spent hours trying multiple ways and i just cant figure out why its no working.
My setup.
I have a gallery named "gallery1_5", this gallery's items property is a collection called "CatalogueSupplier". The collection is Collected from a sharepoint list called "materialsList".
I have the gallery setup so that i can edit the gallery and patch/update the collection ("CatalogueSupplier") and then once happy with the changes the user can then click a confirm button and it then goes and patches the datasource "MaterialsList" with the changes. This all works fine so my patching skills are somewhat working.
When testing this, I realized that if a mistake was made during the editing process there isnt a way to "Undo", so what i wanted to do was to be able to have another button with the "Undo" icon which would write back the orignal record to the gallery, effectively undoing any changes they had made to that record.
I have tried lots of ways, the way below is what looks correct to me, but nothing will work. My issue seems to be that the lookup isnt bringing the records through, however when i create a gallery in order to test the lookup with the same lookup code that seems to work. Its frying my brain and kept me up till 1am last night and i've spent another 2 hours on it today so i've had to succumb to putting my issues on the forum.
Patch(CatalogueSupplier,Gallery1_5.Selected, LookUp(MaterialList, BELREF = ThisItem.BELREF),{CATEGORY:ThisItem.CATEGORY})
Patch(CatalogueSupplier,LookUp(MaterialList, BELREF=ThisItem.BELREF),{CATEGORY:ThisItem.CATEGORY})
LookUp(MaterialList, BELREF = ThisItem.BELREF,Patch(CatalogueSupplier,Gallery1_5.Selected,{CATEGORY:ThisItem.CATEGORY}))
I have attached some picture of the APP and the Datasource, Collection, and gallery.
the column names in the Datasource "materialList" says Title, but this is usually reference in the app a BELREF which is what the columns name is in the list settings
Hope someone can help and point out my error.
Many thanks in advance,