cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jaylou
Level 8

Patch expression not working (operation invalid)

Hi all,

Working on my first app, I have a SPO list that holds static information, and fill in text and numeric columns which I want to load into a history list.  

 

When the app opens I have a dropdown control to filter the details.

The static columns (name, address, blah blah) are read only, and the user will enter data, which are numeric datatypes.  My list columns are currency that I want the Patch to load.  

 

I added the below code for the Patch in the "OnSelect" of my submit button.  At first it was complaining about me using .text for numeric fields, so I removed it and it stopped complaining 🙂 , I thought all would work, but it did not load the history list, It updated the static info list (at least I hint break my app completely 🙂 ).

below is my code with the error I received after running the app (unpublished).  The error is showing "Object must implement | Convertible...  I am not sure what needs to be converted, and why it was not complaining while I was building it ...

 

PatchCoddeForSurvey1.jpg

 

Any and all ideas would be greatly appreciated...

 

TIA,

Joe

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Patch expression not working (operation invalid)

Hey Joe,

You can wrap it in a Value(Yourtext.Text) and it will make it a number.  There is a shortcut to making sure that a field is numeric, just multiply it *1.  Yourtext.Text*1 is the same as Value(Yourtext.Text)

View solution in original post

4 REPLIES 4
Highlighted
Super User
Super User

Re: Patch expression not working (operation invalid)

Hi @jaylou,

This would be my suggestion.  Before doing anything, Create a Collection from your list Collect(colParkRateSurvey, 'Park Rate Survey') and do the testing on the collection so you don't mess up your original data.  Start with a blank screen and put on 2 buttons, one to create the collection and the second to do the Patch. Also puta  Datatable on a screen with its items property set to Sort(colParkRateSurvey,ID,Descending) so you can see if experiments with the Patch work.  When you find the problem, you can apply the solution to your original list.

  • The first thing I would look at is if any of the columns in the list are Choice, Person or Lookup.  In my experience those are the most likely source of problems in Powerapps. If they are, get rid of them and make separate lists for them and import them as datasources in your app and use Lookup() in powerapps to reference them. For Choice columns you can simply change them to Single line of text in Sharepoint. 
  • Second, are there any columns in the list that are Required and are not being patched? 
  • Third, start by building out the third element of the Patch() ie. the items between the {} one by one until you find the one with the problem.
  • Fourth, since you are using Patch to add an item to your data source and not editing already existing items, you can use Collect() instead of Patch.  The syntax would be Collect(colParkRateSurvey,{PKregion: blah blah blah}). 

Hopefully, this will get you on the right track. If you find the problem and can solve it yourself, please post how you did it so others might benefit. If you can't, maybe you can narrow down the issue and repost.  If my suggestions helped please mark the discussion as solved. 

joef
Level 8

Re: Patch expression not working (operation invalid)

Hi @Drrickryp,

I am patching all required fields, and there are no dropdowns or people.   

if I remove all numeric columns from the patch it works fine.  There seems to be an issue trying to send a numeric PA column to a numeric SPO column.  PA seems to be complaining about a conversion, but why?

When I pass a text column over, I refrence the <col>".Text"  Is there an attribute for a numeric column? 

Maybe that's all I am missing?

 

Thanks Again,

Joe

 

Super User
Super User

Re: Patch expression not working (operation invalid)

Hey Joe,

You can wrap it in a Value(Yourtext.Text) and it will make it a number.  There is a shortcut to making sure that a field is numeric, just multiply it *1.  Yourtext.Text*1 is the same as Value(Yourtext.Text)

View solution in original post

joef
Level 8

Re: Patch expression not working (operation invalid)

Thank you so much!!!!!!!!!!!!!!!!

I knew it was something simple like that 🙂

 

Thanks again!!

Joe

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,550)