cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kenneth1
Regular Visitor

Patching from Gallery to List -- only updating the first row/record

Using SharePoint List titled, "Site_Planned_Metrics" -- I have created a Gallery that returns the SharePoint list based on the userid. There may be instances where the user would fill out multiple rows. Unfortunately, when selecting the update icon (check mark), it removes all values from the gallery and updates only the row data where the icon is present. In affect, user could enter data for 3 rows, click on the icon, and only one row would be updated.

1) Ideally, I would like to see information remain in the gallery and not be cleared -- just indicate to user that record has been updated.

2) Ideally, I would like to see user to view the icon only if updates are being initiated AND selecting that ICON in that row only updates THAT row.

I'm new so go easy on me 🙂

 
 

Using the following code: 

Patch(Site_Planned_Metrics,ThisItem,{SAFETY: txtSAFETY.Text}, {PEOPLE:txtPEOPLE.Text},{QUALITY:txtQUALITY.Text}, {DELIVERY:txtDELIVERY.Text},{COST:txtCOST.Text})

Site_Planned_Metrics.JPGScreenCapture.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: Patching from Gallery to List -- only updating the first row/record

Hi @Kenneth1 ,

Do you add a "Check mark" icon within your Gallery?

Do you also want to submit multiple rows back to your SP list at same time with one button click?

Further, could you please share more details about the formula typed within the Items property of the Gallery?

 

Based on the needs that you mentioned, I have made a test on my side, please consider take a try with the following workaround:

Set the Items property of the Gallery to following:

Site_Planned_Metrics

Within the Gallery, set the Default property of the SAFETY Text Box to following:

ThisItem.SAFETY

set the Default property of the PEOPLE Text Box to following:

ThisItem.PEOPLE

set the Default property of the QUALITY Text Box to following:

ThisItem.QUALITY

set the Default property of the DELIVERY Text Box to following:

ThisItem.DELIVERY

set the Default property of the COST Text Box to following:

ThisItem.COST

 

Set the Visible property of the "Check mark" icon to following:

If(
   txtSAFETY.Text <> ThisItem.SAFETY || txtPEOPLE.Text <> ThisItem.PEOPLE || txtQUALITY.Text <> ThisItem.QUALITY || txtDELIVERY.Text <> ThisItem.DELIVERY || txtCOST.Text <> ThisItem.COST,
   true,
   false
)

Set the OnSelect property of the "Check mark" icon to following:

Patch(
      Site_Planned_Metrics,
      ThisItem,
      {
        SAFETY: txtSAFETY.Text,
        PEOPLE: txtPEOPLE.Text,
        QUALITY: txtQUALITY.Text,
        DELIVERY: txtDELIVERY.Text,
        COST: txtCOST.Text
      }
);
If(   // Show up a message when you update record successfully
   IsEmpty(Errors(Site_Planned_Metrics)),
   Notify("Updated Successfully!",  NotificationType.Success),
   Notify("Updated Fail!",  NotificationType.Error)
)

 

In addition, if you also want to submit multiple rows at the same time with a single button, please consider take a try with the following workaround:

Add a button outside the Gallery, called "Submit". Set the OnSelect property of the "Submit" button to following:

ForAll(
       RenameColumns(Gallery1.AllItems, "ID", "ID1"),
       Patch(
             Site_Planned_Metrics,
             LookUp(Site_Planned_Metrics, ID = ID1),
             {
               SAFETY: txtSAFETY.Text,
               PEOPLE: txtPEOPLE.Text,
               QUALITY: txtQUALITY.Text,
               DELIVERY: txtDELIVERY.Text,
               COST: txtCOST.Text
             }
       )   
);
If(   // Show up a message when you update record successfully
   IsEmpty(Errors(Site_Planned_Metrics)),
   Notify("Updated Successfully!",  NotificationType.Success),
   Notify("Updated Fail!",  NotificationType.Error)
)

Please consider take a try with above solution, then check if the issue is solved.

 

More details about the ForAll function in PowerApps, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-forall

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support
Community Support

Re: Patching from Gallery to List -- only updating the first row/record

Hi @Kenneth1 ,

Do you add a "Check mark" icon within your Gallery?

Do you also want to submit multiple rows back to your SP list at same time with one button click?

Further, could you please share more details about the formula typed within the Items property of the Gallery?

 

Based on the needs that you mentioned, I have made a test on my side, please consider take a try with the following workaround:

Set the Items property of the Gallery to following:

Site_Planned_Metrics

Within the Gallery, set the Default property of the SAFETY Text Box to following:

ThisItem.SAFETY

set the Default property of the PEOPLE Text Box to following:

ThisItem.PEOPLE

set the Default property of the QUALITY Text Box to following:

ThisItem.QUALITY

set the Default property of the DELIVERY Text Box to following:

ThisItem.DELIVERY

set the Default property of the COST Text Box to following:

ThisItem.COST

 

Set the Visible property of the "Check mark" icon to following:

If(
   txtSAFETY.Text <> ThisItem.SAFETY || txtPEOPLE.Text <> ThisItem.PEOPLE || txtQUALITY.Text <> ThisItem.QUALITY || txtDELIVERY.Text <> ThisItem.DELIVERY || txtCOST.Text <> ThisItem.COST,
   true,
   false
)

Set the OnSelect property of the "Check mark" icon to following:

Patch(
      Site_Planned_Metrics,
      ThisItem,
      {
        SAFETY: txtSAFETY.Text,
        PEOPLE: txtPEOPLE.Text,
        QUALITY: txtQUALITY.Text,
        DELIVERY: txtDELIVERY.Text,
        COST: txtCOST.Text
      }
);
If(   // Show up a message when you update record successfully
   IsEmpty(Errors(Site_Planned_Metrics)),
   Notify("Updated Successfully!",  NotificationType.Success),
   Notify("Updated Fail!",  NotificationType.Error)
)

 

In addition, if you also want to submit multiple rows at the same time with a single button, please consider take a try with the following workaround:

Add a button outside the Gallery, called "Submit". Set the OnSelect property of the "Submit" button to following:

ForAll(
       RenameColumns(Gallery1.AllItems, "ID", "ID1"),
       Patch(
             Site_Planned_Metrics,
             LookUp(Site_Planned_Metrics, ID = ID1),
             {
               SAFETY: txtSAFETY.Text,
               PEOPLE: txtPEOPLE.Text,
               QUALITY: txtQUALITY.Text,
               DELIVERY: txtDELIVERY.Text,
               COST: txtCOST.Text
             }
       )   
);
If(   // Show up a message when you update record successfully
   IsEmpty(Errors(Site_Planned_Metrics)),
   Notify("Updated Successfully!",  NotificationType.Success),
   Notify("Updated Fail!",  NotificationType.Error)
)

Please consider take a try with above solution, then check if the issue is solved.

 

More details about the ForAll function in PowerApps, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-forall

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Kenneth1
Regular Visitor

Re: Patching from Gallery to List -- only updating the first row/record

Although my timing to respond back to this thread was slow -- your responsiveness to addressing my issue was outstanding. Thank you for shortening my learning curve for this awesome application!

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (7,341)