cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Cscox21
Frequent Visitor

Patch function issue - Invalid Argument Type (table)

Hello,

 

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 (https://www.youtube.com/watch?v=qJv8IqqL01A) 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: 

Cscox21_0-1618845554643.png

 

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

Cscox21_1-1618845607587.png

 

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.  

Cscox21_2-1618845729672.png

Cscox21_3-1618845759612.png

 

After some discovery it appears Patch only works with Datasources and new Records in collections (https://powerusers.microsoft.com/t5/Building-Power-Apps/Patch-Invalid-argument-type-Table-Expecting-...)

 

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!!!

 

0 REPLIES 0

Helpful resources

Announcements
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!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

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)