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 / Update a collection
Power Apps
Unanswered

Update a collection

(0) ShareShare
ReportReport
Posted on by 331
Hello all,
 
I've a problem updating a collection ; here's the scenario:
 
 
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.
 
 
I have the same question (0)
  • ronaldwalcott Profile Picture
    3,862 Moderator on at
    Looks as if you are updating records and not completely replacing all of the records so ForAll is generally the way to do this.
  • forstera Profile Picture
    331 on at
    s'est @ronaldwalcott thank you very much for your answer. In this case i could perfectly update the whole record. I already tried that with the error i mentionned.
    The collection that needs to be updated contains x records from my SharePoint list and my second collection contains a smaller group that need toi je updated ; these records come from my first collection. Once the records updated, I'd like to push them in my first collection to update the correspondind records. I hopped i could do that in 1 shot but it seems this is not possible ?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 519 Most Valuable Professional

#2
11manish Profile Picture

11manish 489

#3
Haque Profile Picture

Haque 327

Last 30 days Overall leaderboard