cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CharlotteOliver
Level: Powered On

Patch

Hi,

 

I am trying to change the data in a sharepoint list when a user selects the 'title' and inputs hours into a form. I am using the following code to select the title that the user chose in the app and change the hours for that title in the sharepoint:

 

Patch(DemoFleet,First(Filter(DemoFleet,Title=DataCardValue73.SearchText)),{CurrentHours:DataCardValue33.Text})

 

Where the datacardvalue73 is the title they selected but its from a different sharepoint, then datacardvalue33 is the hours they input.

 

What do I need to change?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Patch

Yes, based on the screenshots above I think the text you are looking for will be in

DataCardValue20.Selected.Value


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

18 REPLIES 18
Dual Super User
Dual Super User

Re: Patch

Try switching from SearchText to just Text as the property being compared.

Patch(DemoFleet,First(Filter(DemoFleet,Title=DataCardValue73.Text)),{CurrentHoursSmiley Very HappyataCardValue33.Text})

I'm not sure where 'SearchText' is coming from. A datacard in a SharePoint list bound to the title field would store the Text input in 'Text'.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
CharlotteOliver
Level: Powered On

Re: Patch

have tried using just Text and it came up as name invalid, SearchText seemed to be the only thing that would eliminate the error codes, however when it runs it doesn't do anything to the sharepoint data.

Dual Super User
Dual Super User

Re: Patch

What kind of datacard is datacardvalue73?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
CharlotteOliver
Level: Powered On

Re: Patch

I had to change it as it wasn't working as it was a drop down box with lots of titles, so it is now named datacardvalue20, but its just a drop down selection but its for a different sharepoint to the one that I am trying to amend. As I was hoping it would read the selection and then find it in the other sharepoint list.

Dual Super User
Dual Super User

Re: Patch

If its a dropdown then you need to figure out which field in the dropdown has the text value you want to use for filtering.  Dropdowns will usually use dropdownname.selected.value but it can be a different field name depending on what is loaded into the dropdown.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
CharlotteOliver
Level: Powered On

Re: Patch

I have created one sharepoint with headings but for this drop down box I used the choice setting for the column in sharepoint and then included all of the choices, they are all 8 digit numbers. This has formed the drop down, I am then trying to pull the selected number from this and find that row in my other sharepoint, which is full of data, in order to change the hours, if that makes sense. I'm very new to powerapps so I was searching what was best to use and it said I should use the patch function so I'm trying to make it work for that. Is there another way I could do that?

Dual Super User
Dual Super User

Re: Patch

Patch is the right way to do it.  Start your troubleshooting by replacing the datacard designation temporarily with a hard coded entry for the value you want to use.  See if that works.  If it does then its a matter of figuring out how to get the right value from the dropdown. It may also be a number vs text formatting issue.  But get a hardcoded version working first.  Then you can move on to the next step.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
CharlotteOliver
Level: Powered On

Re: Patch

So by a hard coded entry you mean where the user has to type in the number themselves?

CharlotteOliver
Level: Powered On

Re: Patch

This is the code I have written in order to store the form into one sharepoint list and the collect aspect has worked for the dropdown box, just not the patch

 

SubmitForm(EditForm2);Collect(DemoSignOff,{Title:"Demo",Date:Text(Now(),"[$-en-GB]mm/dd/yyyy hh:mm:ss"),Wholegood:DataCardValue20.Selected, SalesmanName:Label3.Text,DemoLocation:DataCardValue34.Text,CheckedOver:DataCardValue29.Selected,Cleaned:DataCardValue30.Selected,MachineHours:DataCardValue33.Text});Patch(DemoFleet,First(Filter(DemoFleet,Title=DataCardValue20.SearchText)),{CurrentHours:DataCardValue33.Text});ResetForm(EditForm2);Navigate(MachineSignOffSuccess, ScreenTransition.Cover)

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,700)