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
Solved! Go to Solution.
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.
I took a fugitive look to your code ... The are some {....} missing.
The correct format of patch function is:
Patch ( source, record, {name of element: the new value of element, ...}).
Few questions:
1. What column in the SQL Table are you patching to, Selection_Open or reasoncode
2. Are you patching from a collection or directly from your form
------------
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.
Hi, I want to overwrite the entry in Column "reasoncode"
I use this function to set the selection from the gallery for "Selection_Open":
see another screenshot attached, hope it makes it more clear?
As I can see....
Selection_Open is a selected item from a gallery.
reasoncode is a column of type varchar (or similar) from one SQL Table and
Stillstandsklassen_Open is a dropdown control (Stillstandsklassen_Open.SelectedText is not a string, it is a record value, so doesn't match with reasoncode).
So,
the wrong part is ,as @eka24 wrote before, Stillstandsklassen_Open.SelectedText. The correct form is Stillstandsklassen_Open.SelectedText.Value (or you can choose a column containing the desired value).
Please keep in mind that if the source of your dropdown control is a collection, then you can refer inside the Stillstandsklassen_Open.SelectedText to column showed in dropdown or to another column from the selected record.
Hope it helps !
Hi, thanks a lot so I changed the code a bit:
---
Try:
Patch('[dbo].[Werma_Downtime_7days]',{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.
Hi @eka24,
this code gave me the error "no acess to write/ Primary Key does not exist" so I realized that I was pointing to a View and not the actual SQL table - now I changed to:
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
183 | |
46 | |
46 | |
34 | |
33 |
User | Count |
---|---|
260 | |
87 | |
79 | |
68 | |
67 |