web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / updating entry in gall...
Power Apps
Unanswered

updating entry in gallery from collection

(0) ShareShare
ReportReport
Posted on by 407

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

Categories:
I have the same question (0)
  • Matt383 Profile Picture
    407 on at

    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>&nbsp;</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>&nbsp;</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.

  • v-qiaqi@microsoft.com Profile Picture
    on at

    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.

    1. Connect to your collection. I collect a table to be my collection ColA
    2. Set the Items property of the Gallery1 as below: ColA
    3. Set the OnSelect property of the narrow button as:

     

    Navigate(Screen2, ScreenTransition.None)

     

    • Set the TextInput within the Screen2 Default property as below:

     

    Gallery1.Selected.EmployeeID​

     

    • Set the Save button OnSelect property as below:

     

    Patch(ColA,Gallery1.Selected,{EmployeeID:TextInput3.Text})​

     

     Check the above steps, if your issue is still,  please consider the following possibilities:

    1. Server
    2. Browser cache 
    3. Connection crash
    4. Account authentication

    >>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

  • RishabBehl31 Profile Picture
    180 on at

    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

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 428

#2
WarrenBelz Profile Picture

WarrenBelz 374 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 333 Super User 2025 Season 2

Last 30 days Overall leaderboard