cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

ForAll on Patching a Subgallery

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,

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: ForAll on Patching a Subgallery

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.

View solution in original post

3 REPLIES 3
Highlighted
Community Support
Community Support

Re: ForAll on Patching a Subgallery

 

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

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: ForAll on Patching a Subgallery

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

Highlighted
Frequent Visitor

Re: ForAll on Patching a Subgallery

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.

View solution in original post

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,930)