cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

patching issue requires to push the button twice to update the data in data base

Hi,
I am facing a problem with patch.
while updating the data in the data base in single click ,it didn't work
But after clicking twice it is updating the database.

Please suggest.....

6 REPLIES 6
Phydax
Frequent Visitor

Hi @Anonymous ,

we need more info to help you, could you please at least send the code of the OnSelect of your button? 


Anonymous
Not applicable

Hi,
Below is the code for Patch function:

 

Patch(
'[dbo].[Requests]',
First(
Filter(
'[dbo].[Requests]',
RequestID = varRequestID
)
),
{
ApprovedBy: varUser,
RequestStatus: varAction,
ResponseDate: Now(),
ResponseComments: varComment

}
);

In the above code I am trying to update the data in the Request table using Patch
But on the first click this particular column "RequestStatus" is not being pushed and on the second click its getting updated.
So my question is why its is getting pushed on the second click and not on the first click.

Note: The column is getting updated twice after the second click but not changed in the first click.

Thanks in advance...

Phydax
Frequent Visitor

Where/when is varAction initialized/modified?

Before you click, go to the top left of your screen and click views, then variable.
What is the value of varAction before you click, after you click, and after the second click?

Anonymous
Not applicable

Hi Phydax,

The patch function is running on select of a button which in there on a popup.
To generate that pop up we are clicking on a button and on click of that button we are even passing the value of "varAction".
The value we are passing is "Approved" . I have checked in the "View" and it is passing the value as "Approved" but its not being updated in the database.
where as other values are being updated in the database.

 

Thanks in advance...

Hi @Anonymous 

 

Can you try to check if this double click behaviour occurs in a different browser as well? If not, then please clear the cache of the browser and login again. Also, make sure that the browser is in its latest version.

Regarding the field not getting updated, what is the type of field in the datasource and what is the value that you are passing?

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

MaxEgn
Frequent Visitor

I'm having a similar issue.... 

 

[For context, the purpose of this function is checking for duplicate orders within 16 different meta data tables]


I have a gallery that when I select a row, it highlights and does a ClearCollect and a patch on various datatables depending on what row was selected on the gallery.  The ClearCollect works fine and even the patch seems to work fine most of the time.  BUT... There is a duplicate warning label that pops up if the Collection contains any records.  This label shows up properly only about 85% of the time.  But it will show up upon clicking that same gallery row again. 

 

I know I'm probably being a bit vague here, but the root of it here is that it feels crazy to have code that executes most of the time, but not every single time.  But will work if you click again.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

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