web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Invalid argument type ...
Power Apps
Unanswered

Invalid argument type (Table), Expecting a Record value instead.

(1) ShareShare
ReportReport
Posted on by 21

This is a real puzzler!


I have a gallery displaying a collection (works fine). The collection is built from a SharePoint List.

I have a button, which contains an OnSelect action. The button has started to display an error for the following code:

 

 Patch(
 'My SharePoint List',
 UpdateIf(
 TmpcolGridData,
 Created = Blank(),
 {ID: Blank()}
 )
 );

 

Invalid argument type (Table). Expecting a Record Value instead.

The function 'Patch' has some invalid arguments.

Cannot use a non-record in this context: 'UpdateIf(TmpcolGridData, Created = Blank(), {ID:Blank()})'.

The main sticking point seems to be with the UpdateIf. Both of these columns exist in the Collection.

Any advice would be much appreciated.

 

Regards

 

Rob

Categories:
I have the same question (0)
  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    @robertmsawyer 

    What exactly are you intending to do here, by nesting a call to UpdateIf inside a call to Patch?

     

    The call to UpdateIf returns a table. If you refer to the documentation beneath, the Patch function expects another table (ie, Patch(DataSource, BaseRecordsTable, ChangeRecordTable1))

     

    As you're passing a single table, the error message is prompting you to choose the other usage(ie, Patch(DataSource, BaseRecord, ChangeRecord1))

     

    https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-patch

     

    timl_0-1677188296663.png

     

  • robertmsawyer Profile Picture
    21 on at

    The intention is to provide a bulk creation and copy feature. The created date is blank for these new entries. Therefore, only process those items. It's a technique used in a Reza YouTube video. Ill share the link tomorrow.

  • Verified answer
    robertmsawyer Profile Picture
    21 on at

    I am pleased to say I have fixed the issue. The issue was in the collection.

    I had renamed my title field in my SharePoint list (common scenario). For reasons unknown the collection included two columns - Title and the new display name. The Patch function didn't like this as there was a mismatch in columns held in the collections (this could be a bug?).

    To fix the issue, I had to remove all references to the collection for the schema to be removed. Save and close the app, then add the collection again. This time, it only included "Title" and the Patch function is happy!

     

    NOTE: If anyone from Microsoft reads this message. Can you please include the following functions for collections:

     

    1. Delete/Remove collection - Delete(collectionname). Not clear(), clearcollect() or removedata()

    2. Provide a references list like variables for collections so you can easily see where the collection is being set or used.

  • Community Power Platform Member Profile Picture
    on at

    Hey @robertmsawyer, i'm facing exactly your same problem. The code was working correctly until i delete a column in the sql server source table, after that i receive the error:  'Invalid argument type (Table), Expecting a Record value instead'. I tried to delete one by one the references to the collction in the app, then save and exit from the app. However when i put back the collection in the app, the error is still present. I'm missing something in order to fix the bug? Thanks

     

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @robertmsawyer I think you try to either intentionally, (or unintentionally), use the (I think it's undocumented in the documentation) 2-arg Patch(DataSource, RecordToCreateOrChange) Where RecordToCreateOrChange is either a single record that has, or does not have, the Primary Key (ID in a SharePoint List). When the Primary Key is present, it updates - if omitted, it creates. This is different from the documented 2-arg Patch(Record, Record)

    Using this undocumented version of Patch,

     Patch(DataSource, RecordToCreateOrChange)

    I think it means if argument 1 is data source, argument #2 must be a single record to either create or to modify as above and cannot be a collection in that specific context in particular.

    Make sure Record #2 is only a single record.

    Or, use the documented 3-arg version of Patch for multiple Records, where you provide #2 as a table of base records, #3 as a corresponding table of change records to apply. Or for creating multiple records, arg#2 should be Defaults(yourDataSource).

    See if it helps @robertmsawyer 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard