I'm developing a leave request solution for my school.
I have several sharepoint lists connected to each other using Lookup fields.
When a teacher starts the tool, I create a collection with his weekly schedule.
Once the teacher has determined the start and end dates of his absence, I display his schedule (by week) and he can, for each period taught, determine the person who will replace him.
I therefore create a sharepoint list with all the days of absence and, for each day, 13 time slots. If he teaches in one of these slots, his lesson is displayed and he can name a replacement.
To do this, I create a 'timetable' collection from my sharepoint list, which copies the records from my sharepoint list for all the lessons in the week displayed.
I also create a second empty collection called 'SelectionList'. Each time a teacher period is selected for a treatment (see image below), the corresponding record is copied into my 'selected' collection.
I can here select the periods I want to treat and then choose, for these selected periods, the teacher who's going to teach them. The items of my screen have my collection 'TimeTable' as source.
Once he's selected a substitute and the classes he'll be assigned, I use a patch function to modify all the records in the sharepoint list affected.
UpdateIf(SelectionList;true;{Operation:Choix_Option.Selected;QuiRemplace:Remplacant_Interne.Selected.Sigle});;
Patch(MyShareointList;ShowColumns
(
SelectionList;
ID;
Operation;
QuiRemplace
)
);;
This works very well to update my sharepoint list.
I now want to modify my TimeTable collection so that the changes appear in my poster below, but I get the following error:
"The data source supplied to the function is invalid."
Isn't there a way of updating my collection in a single command without using a 'forall' ; something like this ?
ForAll(
SelectionList;
Patch(
TimeTable;
LookUp(TimeTable; ID = ThisRecord.ID);
{
Operation: ThisRecord.Operation ;
QuiRemplace: ThisRecord.QuiRemplace
}
)
);;
I can't understand why the patch works on a sharepoint list and not on a collection.