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 / Invalid data source fo...
Power Apps
Answered

Invalid data source for ForAll function (and embedded Patch & Lookup functions)

(0) ShareShare
ReportReport
Posted on by 61

Hello,

 

I'm trying to create a bulk update on my timesheet data PowerApp. I have a data table, drop downs for filters and then a button called Bulk Edit Status. OnSelect on the button I'm creating a new collection called colFilteredTimesheets - which contains all the currently displayed timesheet entries based on the filters set by the users. I've checked and the collection is being created successfully.

 

My user will then choose a Status value from a drop down box and I want to bulk update all records to the new status. I have the following code on my save button:

 

ForAll(
    RenameColumns(
        colFilteredTimesheets,
        "ID",
        "PT ID"
    ),
    Patch(colFilteredTimesheets,
        LookUp(colFilteredTimesheets,ID = 'PT ID'),
        {Status: drpBulkEditStatus.SelectedText}
    )
)

 

I'm getting an error saying "The data source supplied to the function is invalid".

 

Any suggestions?

 

Thank you 🙂

Jo-Anne

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @JoAnneCharlotte 

    Are you just trying to update 'Status' for all records in your collection (ie colFilteredTimesheets) OR are you attempting to update a data source, such as SharePoint?

     

    If you are just updating your collection, something like this should work:

    UpdateIf( colFilteredTimesheets, true, {Status: drpBulkEditStatus.SelectedText} )

     

     

  • JoAnneCharlotte Profile Picture
    61 on at
    Both eventually. The data is collected in the app, I’m trying to update all records in the collection (code I posted). Once I got that working I will need to sync the updated records in the collection back to SP.
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Ok. Did you try the code I posted? Did it work?

  • JoAnneCharlotte Profile Picture
    61 on at

    just tried it - no luck - getting a new error "Invalid argument type. Expecting a Record value, but of a different schema."

     

    I checked my colFilteredTimesheets collection, it's been created and the Status field is present...

     

    Plot thickens! Any other suggestions?

  • JoAnneCharlotte Profile Picture
    61 on at

    Update - I've managed to get the ForAll to work - I'm struggling to understand how TBH - I posted last night (early morning) with the issue, then went to bed - came back online and tried the UpdateIF, that didn't work so tried ForAll again and now it works... anyway...

     

    Now that my collection is updated I need to send the updates back to the SharePoint list - is ForAll going to work for this or am I am hit delegation issues?

     

    Any suggestions for alternatives to save back to SP?

     

    Thank you! 🙂

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @JoAnneCharlotte 

    Could you please post the code you got to work. I suspect you will need to use ForAll and Patch again due to the schema error you were getting.

  • JoAnneCharlotte Profile Picture
    61 on at
    Hi - it’s the code in the original post... I’d lost a comma at some point and my data table had a different source so it looked like nothing had happened.
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @JoAnneCharlotte ,

    Do you want to patch the updated colFilteredTimesheets collection back to your SP List?

     

    Based on the needs that you mentioned, I think the ForAll function and Patch function could achieve your needs. On your side, you should type the following formula:

    ForAll(
     colFilteredTimesheets,
     Patch(
     'Your SP List',
     LookUp('Your SP List', ID = colFilteredTimesheets[@ID]),
     {
     Title: colFilteredTimesheets[@Title],
     Status: colFilteredTimesheets[@Status],
     ...
     ...
     }
     )
    )

     

    The above ForAll formula would not cause a Delegation warning issue, the colFilteredTimesheets is a collection, which is not subject to Delegation issue.

    Note: The RenameColumns function is not a Delegable function, so please remove the RenameColumns function from your ForAll formula, otherwise, it would cause a Delegation issue.

     

     

    Best regards,

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
Haque Profile Picture

Haque 103

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
wolenberg_ Profile Picture

wolenberg_ 67 Super User 2026 Season 1

Last 30 days Overall leaderboard