I have a gallery with a local collection as the datasource. I want to be able to edit the entry in the gallery and save it to the collection. i have the arrow in the gallery navigating to a new screen with inputs connected to the gallery e.g. (default value Gallery1.selected.MachineID), i have a button on the same screen with the onselect value
Patch(KBXCollection,Gallery1.Selected, {MachineID: TextInput3.Text}) but it wont update the record. I ran the same syntax on an earlier app and it worked fine, not sure what is different. Can you please assist
Kind regards,
Matt383
Here is a little more info, i add the image to a collection using
Collect(KBXCollection, {Title: Employee_ED.Selected.Value, Image1:Substitute(JSON(UploadedImage1.Image,JSONFormat.IncludeBinaryData),"""","")}); Reset(AddMediaButton1);Reset(Employee_ED);SaveData(KBXCollection,"KBXCollectKeep");Navigate(ED_Collection) the image is captured using an addpicture control
On the ED_Collection screen, i have a gallery with the data source set to KBXCollection, within the gallery, a chevron arrow navigating to another screen named CollectEdit2. On this screen, a textinput with the default value set to CollectGallery.Selected.Title and an add picture control with the UploadedImage5 sample set to;
If(IsBlank(AddMediaButton1.Media), CollectGallery.Selected.Image1, AddMediaButton1.Media)
On the same page, i have a button with the onselect set to Patch(KBXCollection, CollectGallery.Selected, {Title: Employee_2.Selected.Value, Image1: AddMediaButton2}) (I have also tried UploadedImage2)
I then have a button that saves all this through a flow onedrive to pdf; sample below
p> </p>
<p><strong>Images of work conducted:</strong></p>
<p><img src="&JSON(CollectGallery.Selected.Image1, JSONFormat.IgnoreBinaryData)&" type='image/png' style='width:75px;height:75px'><img src="&JSON(CollectGallery.Selected.Image2, JSONFormat.IgnoreBinaryData)&" type='image/png' style='width:75px;height:75px'><img src="&JSON(CollectGallery.Selected.Image3, JSONFormat.IgnoreBinaryData)&" type='image/png' style='width:75px;height:75px'><img src="&JSON(CollectGallery.Selected.Image4, JSONFormat.IgnoreBinaryData)&" type='image/png' style='width:75px;height:75px'></p>
<p> </p>
<table style='height: 5px;' width='564'>
<tbody>
<tr>
<td style='width: 555.2px;'><strong>Parts</strong></td>
Patch(KBXoffline, Defaults(KBXoffline),{Title: CollectGallery.Selected.Title,Image1: CollectGallery.Selected.Image1});
Remove(KBXCollection,ThisItem);
SaveData(KBXCollection,"KBXCollectKeep")
Just want to be able to add the image, then have the option to go back in to the entry and edit the image before submitting to sharepoint.
Hi@Matt383,
Based on the issue that you mentioned, do you want to update the gallery selected item?
Could you please share a bit more about the screen where you set the default value Gallery1.Selected.MachineID?
I have a test on my side and I don't have the same problem.
You could check the following steps for reference.
Navigate(Screen2, ScreenTransition.None)
Gallery1.Selected.EmployeeID​
Patch(ColA,Gallery1.Selected,{EmployeeID:TextInput3.Text})​
Check the above steps, if your issue is still, please consider the following possibilities:
>>If it is the server crash, you should contact our support team. However, I don't think this is the key to your issue.
>>So does the third point, you could change a browser and clear the cache to check if this works.
I want to clarify that it could be the connection crash or the account authentication.
>>The connection brings the data from the data source to PowerApps, if you have refreshed the local Collection and nothing changes, it will be the connection issue I think.
Please try to remove the connection firstly which is important. And then add this connection again to see if the Patch() function works.
>>And for the account authentication, Sometimes your account verification may have expired or you may have changed your account password or something like that. What you need to do is to log out and log back in so that your account can be verified again.
Hope it could help.
Best Regards,
Qi
Hey @Matt383 ,
After you do patch function. Is it not updating the record in the collection or is updated in the collection and not updating on gallery.
If the second one is true try applying refresh function after you've applied Patch function to that collection.
Syntax: Refresh(KBXCollection)
I hope this simplifies your query if any more question let me know.
Warmly
----------------------------------------------------------------------------------------------------------------
Thanks for taking my inputs. If you're digging into it, a Thumbs up is appreciated! Or if my suggestion solved your issue, please Accept it as a solution. This way everyone would be able to get the solution if they face a similar problem