cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rudy_Digital
Helper II
Helper II

Patching data from collection to sharepoint list

Hello, 
I'm trying to patch data from a collection to sharepoint list but i'm having the following error message. (The requested operation is invalid. Server Response: TIS Production Machine Inventory failed: Obkect must be implement Iconvertible)

 

Below is my code:

Capture d’écran 2022-08-16 200150.png

My app looks like this:

Capture d’écran 2022-08-16 200220.png

 

My SP list is as follows:

Capture d’écran 2022-08-16 200251.png

 

thanks

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Rudy_Digital 

To start, your formula has the ForAll backward. You are trying to use it like a ForLoop in some development language - which PowerApps is not.  ForAll is a function that returns a table of records based on your iteration table and record schema.

It is more efficient to use the function as intended and will provide better performance.

 

In general, you do NOT want to be providing the schema for your patch.  Your Collection should match the schema of the datasource.

When that is correct, then doing a Patch('TIS Production Machine Inventory', MachineInventory) is all you need to do.

 

Looking at your formula though, you appear to have "hand written" in the column names of your collection rather than use the actual column names.

So, the choices are to fix your collection to have the proper column names, or change your formula to use the ForAll properly.  i.e.  Patch('TIS Production Machine Inventory'. ForAll(MachineInventory, {....}))

You don't need the Defaults to create a record.  Patch will be smart enough to do that for you.

 

Now, as to your actual error...my guess is that one of your columns is NOT a text column but instead a choice column.  If so, then you need to be supplying the proper record for the choice column.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

2 REPLIES 2
RandyHayes
Super User
Super User

@Rudy_Digital 

To start, your formula has the ForAll backward. You are trying to use it like a ForLoop in some development language - which PowerApps is not.  ForAll is a function that returns a table of records based on your iteration table and record schema.

It is more efficient to use the function as intended and will provide better performance.

 

In general, you do NOT want to be providing the schema for your patch.  Your Collection should match the schema of the datasource.

When that is correct, then doing a Patch('TIS Production Machine Inventory', MachineInventory) is all you need to do.

 

Looking at your formula though, you appear to have "hand written" in the column names of your collection rather than use the actual column names.

So, the choices are to fix your collection to have the proper column names, or change your formula to use the ForAll properly.  i.e.  Patch('TIS Production Machine Inventory'. ForAll(MachineInventory, {....}))

You don't need the Defaults to create a record.  Patch will be smart enough to do that for you.

 

Now, as to your actual error...my guess is that one of your columns is NOT a text column but instead a choice column.  If so, then you need to be supplying the proper record for the choice column.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

I used your logic and made some small changes and it is working perfectly.
Thank you very much 🙂

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,254)