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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / ForAll on Patching a S...
Power Apps
Answered

ForAll on Patching a Subgallery

(0) ShareShare
ReportReport
Posted on by 22

I'm creating a Gradebook for teachers and so far have created a Gallery for the StudentRoster and a Subgallery for the AssignmentsList.  In the rough sketch below, the names on the left are the Gallery, and the 1,2,3, etc. are the Subgallery.

 

image.png

 

I'm trying to Patch data that uses items from both a gallery and a subgallery (though I could easily make it work to just pull from the subgallery if needed).

 

The problem I have is that I can't get it to work the same way as pulling data from a regular Gallery. 
Button Code simply does nothing:

 

ForAll(GradeGallery.AllItems,Patch(tblGradebookMaster,Defaults(tblGradebookMaster),{StudentID:Value(Label30_1.Text),CCRecordID:Label25.Text,Rubric:Value(TextInput2.Text),AsID:Value(Label37.Text)}))

 

 

Currently I'm using a work around 'On Change' to save each one individually automatically:

 

If(IsEmpty(Filter(tblGradebookMaster,StudentID=Value(Label30_1.Text),CCRecordID=Label25.Text,AsID=Value(Label37.Text)))=true,

 

Patch(tblGradebookMaster,Defaults(tblGradebookMaster),{StudentID:Value(Label30_1.Text),CCRecordID:Label25.Text,Rubric:Value(TextInput2.Text),AsID:Value(Label37.Text)}),

 

Patch(tblGradebookMaster,First(Filter(tblGradebookMaster,StudentID=Value(Label30_1.Text),CCRecordID=Label25.Text,AsID=Value(Label37.Text))),{Rubric:Value(TextInput2.Text)}))

 

But it causes issues with the data source when the user updates too quickly and disconnects itself.  This is the only work around I've been able to get though.  I'd much prefer being able to collect the whole table at once, but I'd settle for less.

 

Thank you for your time,

Categories:
I have the same question (0)
  • v-micsh-msft Profile Picture
    Microsoft Employee on at

     

    Hi @ChiefPraetor,

     

    Please take a try to switch the Gallery.AllItems with the actual data source.

    For example:

     

    ForAll(DataSourceInGallery,
    Patch(tblGradebookMaster,
    Defaults(tblGradebookMaster),
    {StudentID:Value(Label30_1.Text),
    CCRecordID:Label25.Text,
    Rubric:Value(TextInput2.Text),
    AsID:Value(Label37.Text)}))

    See if that would make any difference.

     

    The workaround seems to be able to update if record exists, and if not, create new.

     

    Further, would you please explain a bit for what you would like to achieve here?

    We may offer a better solutions with a different control other than the Gallery.

     

    Regards,

    Michael

  • ChiefPraetor Profile Picture
    22 on at

    I tried your code, but I see the same issue.  Only 7 records are being created.  It isn't reading for every item of the subgallery, just one.

     

    The goal is to save every rubric to every student shown.  I've split them into two galleries as there are two variables that must be filtered in a gradebook.   I must be able to change who's in the class (names on the left) and I must be able to change the assignments/number of assignments for the class (Test1, etc. on the top).

     

    tblCoreScheduleStudent is a collection of all the students in the course (filtered to create the list in the example for this particular class - CCRecordID)

     

    Fields: StudentID, CCRecordID

     

    tblGradebookAssignments is a collection of all the Assignments (filtered to create the list in the example for this particular class)

     

    Fields: AsID, CCRecordID

     

    tblGradebookMaster is a collection of all the rubrics (grades on the given assignments) connected to each student in the class.

     

    Fields: StudentID, AsID, Rubric, CCRecordID

     

     

    We're trying to patch tblGradebookMaster so that every rubric is patched, whether updated or created new as needed, upon pressing a save button.

     

     

    Thank you for your time, I hope some of that made sense =P

  • Verified answer
    ChiefPraetor Profile Picture
    22 on at

    I ended up making a Collection of all the changes through the On Change Property and then Hit a button to 'Save Changes' that patches the Collection to the Record Table.  Works great.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 427 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard