Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Patch function issue - Invalid Argument Type (table)



I inherited a Powerapp that was functional but not scalable. I am trying to make it scalable and am running into an issue with making a tree hierarchy feature. I am following this tutorial ( and it has been very useful but I cannot get past the Image - OnSelect part (start at timestamp 8:35). 


The function works with the TreeItems collection I have which is set up this way: 



But it does not work with the AllRecords_values collection, set up this way: 



When i try to replace the TreeItems with AllRecords_values in my Image OnSelect function, it gives me the Invalid Argument Type (Table). But as far i can tell (Powerapps newbie), the data type for both TreeItems and the AllRecords is Table. Note, i did replace all the TreeItems variables with AllRecords_values but it still didnt matter.  




After some discovery it appears Patch only works with Datasources and new Records in collections (


I am guessing that it has to do with how the ClearCollect is being done differently between TreeItems and AllRecords_values. The TreeItems has the dbo in there where the AllRecords is referencing another Collection. I do not know how to alter the Patch function to work with the existing code.


I am looking for help with either: using a different function other than Patch or finding a way to make the Patch function work (if possible). One of the users in the Powerapps forum i linked mentioned the UpdateIf function, but I have no idea how to apply this as i dont want to break things while trying to fuddle around with it. Thanks for any help or pointers in the right direction!!!



Helpful resources

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!


Are Your Ready?

Test your skills now with the Cloud Skill Challenge.


Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (100,511)