cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
10101
Frequent Visitor

Powerapps SQL Table; Patch value by button press

Hello,

 

I am trying to edit values in my sql table from a server by pushing a button.

I get this weird error message every time I try to use my data source in the patch function.

 

I want to update the Value of "Zustand" in the row with the ID of my variable IDD.

Patch( '[dbo].[Leuchte]', First( Filter( '[dbo].[Leuchte]', ID = IDD)), {Zustand: "Unsicher"})

 

Thanks for the help

 

{CBCF30CD-E142-4B77-9736-025E06135916}.pngScreenshot 2021-11-10 075828.png

16 REPLIES 16
10101
Frequent Visitor

I changed the code to:

 

Patch( '[dbo].[Leuchte]';
First( Filter( '[dbo].[Leuchte]'; ID = IDD)); {Zustand:"Test"}
)

 

and now I am getting "only" the error badGateway. Could be possible I don't have the rights to change values of the table... Again thanks for the help,

@10101 ,


Try to manually update a record from within SSMS. If it works there, you have to be able to do it from Power Apps as well.

10101
Frequent Visitor

Seems like I have the right to change things in the database... so it must be something else. Thank you for the hint!

timl
Super User
Super User

Hi @10101 

In this scenario, I'd call LookUp rather than First/Filter. I'd also close and reopen your app, as sometimes that can clear "bad gateway" errors.

Patch('[dbo].[Leuchte]';
      LookUp('[dbo].[Leuchte]'; ID = IDD);
      {Zustand:"Test"}
)

 

@10101 ,

 

Where are you taking the 'IDD' from?

if it is a text, you have to use 

LookUp('[dbo].[Leuchte]'; ID = Value(IDD))

to make it work. 

10101
Frequent Visitor

Thanks I changed it to Patch( '[dbo].[Leuchte]'; LookUp( '[dbo].[Leuchte]'; ID = IDD); {Zustand: "Test"}) and I think it is right. But it still doesent work because of the BadGateway...

 

I tried my sql table in other app templates and tried to edit it. Everytime I try to edit the table I get the same error - BadGateway - I think it must be something about the sql server. Again Thank you!

I just got it working.

Powerapps can't handle the datatypes "geometry" and or "vabinary".

Deleted both columns and it works well. ^^

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (4,326)