cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ganesan_gowri
Helper IV
Helper IV

Update gallery items

I have a gallery which filter depending on the dropdown values.

So i need to Update all the records to the Existing Datasource which gallery listed outs. So in my point Both Read and write the record takes place from the same dataSource. So  edited records need to update by replacing the existing record in the Datasource to the particular row.

 

My Screen:

 

I have this Function in ONSelect of the Submit button:

ganesan_gowri_0-1598033266884.png

The error i faced is, it updates one row at a time. So i need to update all the items in the Gallery list.

 

DataSource: aaaa  

excel.png

11 REPLIES 11
krishnags
Responsive Resident
Responsive Resident

@ganesan_gowri it loops through all the records in the gallery - but update happens only to the filtered records. Validate if you have only record matching to the filter in your data source.

Filtering the Gallery depends on dropdowns, i have two records that  matching to the filter in my data source.

Here i have two rows but while hit submit , it update only the first row(aara record) and second row is not getting updated.

 

screen.png

Hi @ganesan_gowri ,'

Your problem is your First() syntax as this will only ever patch one record - try

ForAll(
   Gallery_l. AllItems,
   Patch(
      aaaa, 
      {Facility:Dropdownl_2.Selected.Result},
      {
         Comment :TextInput3_l.Text,
         'TOTAL SCHED':Textlnput2_l.Text
      }
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Thanks for the Answer. 

 

Using your formula it creates a new record in the DataSource.  Actually i get the record From Excel to the Gallery and i use TextBox inside the gallery to edit some of the columns from the excel . So then again i want to save the  edited values by replace the existing values to the particular record without creating a new record. Thanks

Hi @ganesan_gowri ,

The argument

{Facility:Dropdownl_2.Selected.Result}

will update any record where the Field facility in your list matches the item selected in Dropdown1_2, and I took this straight off your code assuming it was what you needed, however you need to refer to a field in the gallery to match the list to identify the correct record to Patch and you have not supplied this. For instance if Facility was in your gallery and you want to patch the matching records - you would do this.

ForAll(
   Gallery_l. AllItems As MyPatch,
   Patch(
      aaaa, 
      {Facility:MyPatch.Facility},
      {
         Comment :TextInput3_l.Text,
         'TOTAL SCHED':Textlnput2_l.Text
      }
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Need to Update the newly edited values by replacing the Existing values to the respective rows. 

 

Depending on the facility selected Gallery will  list out the records. So now i want to edit  the mark and comment for the listed out records. In my gallery For dropdown--> AA it list out 3 record of staffs, students, staffs. so i edited  mark and comment column for all the three records  . While hit save it want to update all the gallery items and replace the old values in DataSource and need to update the newly edited values to the specific fields of staffs and students. The datasource does reads and write to the same File. So i need to update the old values to the New values.

 

Please verify my Screen and Excel Datasource

DataSource: stu

screen2.png

Screen

screen3.png

@ganesan_gowri ,

I am a little lost here - you are referring to a gallery, but have posted a screen shot of a form. What data do you want to update and where is it coming from? Also you do not seem to have a unique value key in your data to identify which record to Patch.

I have a dataSource-Excel.  Gallery refer from the datasource. In the previous screen that i  shared consists of dropdown and gallery with Editable textinput boxes. I used function to filter the Gallery by dropdown Selected. While if i want to re-edit the record values that shows in the gallery i used textinput box to edit and want to update the Re-Edited values to the respective row in the Excel DataSource. 

 

In this case i use First Function. So It Updates only the First record and one record at a time

 

screen3.png

 

 

My need is : To Update all the rows or Records in the gallery to the DataSource with respective to the same record with one button click. I Dropdown values and Type Value as  Unique Values.

@ganesan_gowri ,

Which column do you need to match the value on the form?

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (2,335)