I'm stumped on this. I have a SharePoint list (dStudentSchedule ) I'm patching records to, but some records items in a text column 'Teacher' aren't being treated as text. When I load/filter the dStudentSchedule list into a gallery using Filter(dStudentsSchedule, Teacher = varUser), some of the records aren't showing up. When writing records to the dStudentSchedule list I have two Patches occuring, and the records from the 2nd Patch are the ones not filtering correctly.
Here is my setup. The two seperate Patches occuer on a button OnSelect
First Patch: Patching from lables and text inputs - Patch(dStudentSchedule, Defaults(dStudentsSchedule), { Title: "1819", Teacher: varUser, StudentName: lblNewStudentName.Text, Grade: txtNewStudentGrade.Text, Period: txtNewStudentPeriod.Text, OnContractWithTeacher: true, TeacherConfirmation: true, DateOnContract: dtpNewStudentDate.SelectedDate, Comments: txtNewStudentComments.Text});
varUser is already set to User().Fullname, and the 'Teacher' column in my SharePoint list is formatted for "single line of text". Everything works as expected, but my 2nd Patch is where I'm finding issues.
2nd Patch: Patching 5 records from a collection made up of the collection items and some of the same information from the first patch - ForAll(NewStudentSchedule, Patch(dStudentsSchedule, { Title: "1819", Teacher: Teacher, StudentName: lblNewStudentName.Text, Grade: txtNewStudentGrade.Text, Period: Period, OnContractWithTeacher: false, TeacherConfirmation: false }));
The collection (NewStudentSchedule) is made up of two items, Period and Teacher, and is created through two dropdown selections. User selects a item from drpPeriod ["1", "2", "3", "4", "5", "6", "7"] and also an item from a dropdown of teacher names ["Andrew Fitzgerald", "Teacher B", "Teacher C", etc.]. After the user has selected these two items, they press a button which adds the two values to the collection (NewStudentSchedule).
Button OnSelect --> Collect(NewStudentSchedule, { Period: drpNewStudentPeriod.Selected.Value, Teacher: drpNewStudentTeacher.Selected.Value})
So, when the 2nd Patch goes into effect, everything looks like it worked. On the SharePoint list (dStudentSchedule), the first record gets patched, and then the 5 records from the 2nd patch show up. 6 records total. But, I'm having trouble filtering the list by the 'Teacher' column afterwards. In my PowerApp, I have a gallery and data table showing my dStudentSchedule list. When I use Filter(dStudentsSchedule, Teacher = User().Fullname) or Filter(dStudentsSchedule, Teacher = varUser), or Filter(dStudentsSchedule, Teacher = "Andrew Fitzgerald"), I'm not seeing any records from the 2nd Patch from the NewStudentSchedule collection.
For example, if this is my sharepoint list dStudentSchedule:
From Patch | Teacher | Student | Period |
1st Patch | Andrew Fitzgerald | Johnny Bravo | 4 |
2nd Patch | Teacher B | Johnny Bravo | 1 |
2nd Patch | Teacher C | Johnny Bravo | 2 |
2nd Patch | Teacher D | Johnny Bravo | 3 |
2nd Patch | Teacher E | Johnny Bravo | 6 |
2nd Patch | Andrew Fitzgerald | Johnny Bravo | 7 |
If User().FullName or varUser is me (Andrew Fitzgerald), all I get from my filter is the first record from the 1st Patch and not the last record from the 2nd Patch.
What I've tried: I've tried throwing a Text() around everything associated with the 'Teacher' column; varUser, User().FullName, the Teacher dropdown list, and the Teacher values in the 2nd Patch function. I've also put the collection in a gallery and tried patching the lable boxes in the gallery. Nothing works, the list never filters properly.
What does work:
ForAll(NewStudentSchedule, Patch(dStudentsSchedule, { Title: "1819", Teacher: "Andrew Fitzgerald", StudentName: lblNewStudentName.Text, Grade: txtNewStudentGrade.Text, Period: Period, OnContractWithTeacher: false, TeacherConfirmation: false }))
But in this case, all records will have "Andrew Fitzgerald" in the teacher column, and that's not what I'm looking for.
I feel like the SharePoint list is not treating the 'Teacher' values from the 2nd Patch as text, and somehow it's related to my Teacher Dropdown control, but at this point I have no idea how to fix this.
Anybody know what I'm doing wrong?