cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Oliclusive
Helper I
Helper I

Patch function not working

Hi Community,

 

it is my first time I use the Pacth function and it seems like I don't really understand how the function can be used to Step 3) of the following scenario :

 

1) Select a List item in a Gallery > Selected Item is Stored in a Collection "Selection_Open" > Navigate to an Edit Form (OK)

2) Make a manual selection in a Dropdown for the item to add the "reasoncode" > "Stillstandsklassen_Open.SelectedText" (OK)
3) Save the selected Text from Dropdown back to the SQL table for the selected item (the one selected in Step 1 from the Gallery) > error "reasoncode" field is not found (maybe Syntax error?)

 

I just cant get the Patch function for 3) to work

 

Attached you find the screenshots, any help from a Pro user is appreciated a lot

 

Thanks

Oli

13 REPLIES 13

If you are adding new entries, use Defaults in the Patch:

Patch('[dbo].[Werma_DowntimeSlaveData]';Defaults('[dbo].[Werma_DowntimeSlaveData]');
{reasoncode: Stillstandsklassen_Open.SelectedText.Value})
;;
Back(ScreenTransition.Fade);;

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

View solution in original post

Hi @eka24 ,
nice, almost there.. now I actually get an error message when using the App (see attached "PK_ID" = Primary Key required). The Table does have a Primary ID so I guess somewhere between selecting the item on the Gallery and saving back the new reason code the link to the items ID is lost.

Hi, after some additional trial and error I found a formulary that works:

Patch(
'[dbo].[Werma_DowntimeSlaveData]';
First(Filter('[dbo].[Werma_DowntimeSlaveData]';PK_ID=Selection_Open.PK_ID));
{reasoncode: Stillstandsklassen_Open.SelectedText.Value});;
Back(ScreenTransition.Fade);;

@eka24 : thank you very much for guiding me into the right direction, after all it was just an issue of filtering out the right record based on the selected PK_ID
emseki
Microsoft
Microsoft

Thank you for sharing your issue. This will help other users!

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

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,212)