Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Rendering Issue? Submitting data via a Gallery

(0) ShareShare
ReportReport
Posted on by 4
Hi all,
 
I hope someone can help!
 
Summary
I have an issue on a Canvas app which records an approve/reject decision on a Gallery record.
 
The decision is only being recorded for the first 5 records within the Gallery. I suspect this is because the Patch is only applying to the rendered rows within the gallery.
 
Requirements
The original data is in a SharePoint List, each row in the App has a drop down to approve/reject, and there is an "Approve All" button and a "Reject All" button at the bottom. If either button is pressed it sets the decision on each row to Approve or Reject, then a Submit button is shown. Before you press submit you have the opportunity to review each row and check the decision is correct. Some Approvers aren't then checking the decisions and instead going ahead and clicking the Submit button straight away.
 
In an ideal world, what I'd like to happen is that when the Approve/Remove all buttons are clicked, the Approver is forced to scroll to the bottom of the data before the Submit button is shown (I cannot have the button within the gallery itself)
 
Alternatively, if that isn't possible, just submitting the decision to all records that are in the filter, whether they are rendered or not would be acceptable.
 
App Build
Within the app, we have two galleries:
"galUsers" which shows a list of Users which require an Approve/Remove decision. Once you click on a row, the "galRoles" gallery is updated.
 
"galRoles" which shows all the roles the selected user has and gives the option to Approve/Reject for each row
Filter('SharePointTable', 'End User Name' = galUsers.Selected.Value)
 
The Approve All and Reject all buttons simply sets the Context:
UpdateContext({DecisionValue: "Approve"})
 
On the Submit button, I thought this would work in the Visibility selection:
If(Not(CountRows(Filter('SharePointTable', 'End User Name' = galUsers.Selected.Value))=galRoles.AllItemsCount),false,true)
 
Alternatively, the Submit button OnSelect was set as:
ForAll(galRoles.AllItems, Patch('SharePointTable', {ID:ID}, {ManagerDecision: {Value: comboDecision.Selected.Value}, Status: {Value: "Complete"}}))
 
If further info is needed let me know!
 
If anyone has a solution, I will owe you a drink!
  • Suggested answer
    CU30101613-0 Profile Picture
    CU30101613-0 on at
    Rendering Issue? Submitting data via a Gallery
    Rendering Issue? Submitting data via a GalleryRendering Issue? Submitting data via a GalleryRendering Issue? Submitting data via a Gallery
  • Suggested answer
    RT-29101322-0 Profile Picture
    RT-29101322-0 4 on at
    Rendering Issue? Submitting data via a Gallery
    Ryan, Thanks so much! Let me know if you want to call in that drink :D
     
    As you said, I added the Collection and it applied all the decisions!
     
    For any future readers with the same issue:
     
    In the OnSelect on the Submit button
    Collect(varRoleListing,Filter('SharePointTable', 'End User Name' = galUsers.Selected.Value));
    ForAll(
    //galRoles.AllItems,
    varRoleListing,
    Patch('SharePointTable',{ID:ID},{ManagerDecision: {Value: comboDecision.Selected.Value}, Status: {Value: "Complete"}}))
     
  • Verified answer
    RyanAutomates Profile Picture
    RyanAutomates 70 on at
    Rendering Issue? Submitting data via a Gallery
    Hi there,
     
    As I understand it, the way this is supposed to work is that when a user is selected from gallery 1, the app user can approve/reject the roles individually or using the approve/reject all buttons and submit this decision there and then, i.e. one patch per user at a time.
     
    First off, I wonder if the reason that it's patching a set amount of records at a time is because as you say, the gallery is rendering 5 records or so - but this might be because when you use the galRoles.AllItems part, it suffers from lazy loading, where power apps only loads and renders the items currently in the view to enhance performance. 
    I think if you removed this part and instead built a collection of the approved/rejected records to patch and then refer to this collection in your ForAll(), it would work for them all.
     
    Regarding your ideal world scenario, that would be great, but I haven't heard of a canvas app being able to force you to scroll down to the bottom before allowing something to happen, maybe it can be done with custom components - from a functional perspective, if you wanted to enforce them to actually check each one, you could remove the "All buttons" so they were forced to manually check each record to approve/reject them. Additionally, you could pop up a little box asking them if they have checked each one when they click to submit as a double check.
     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard