web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch Function Doesn´t...
Power Apps
Unanswered

Patch Function Doesn´t update the SQL

(0) ShareShare
ReportReport
Posted on by

Hello,

I´m trying to create an "Update Status" Button in my APP that will update a field in a row of SQL Table.

The function used was:

Patch( '[dbo].[dbo_ft]'; First( Filter( '[dbo].[dbo_ft]'; fno=Value(DataCardValue13.Text) ) ); {fref:"2"})

When clicked the button, the action occurs with no errors but the field "fref" in the SQL table doesn´t update to the value "2".

Anyone knows what could be the problem?

Thanks in advance.

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    Try using this formula. I have removed the semi colon and replaced it with a comma.

    Patch( '[dbo].[dbo_ft]',
    First(
    Filter( '[dbo].[dbo_ft]',
    fno=Value(DataCardValue13.Text)
    )
    ),
    {
    fref:"2"
    }
    )

     

    If this still doesn't work try filtering on the ID column to get the record that you want.

  • v-siky-msft Profile Picture
    on at

    Hi @Anonymous ,

     

    What is the date type of these fields?

    It seems there is no mistake in your formula. It could be some connection error.

    Could you please follow  these steps and check if your issue is fixed?

    1. delete the SQL connection

    2. re-login Gateway

    3. clear the browser cache

    4. re-add the connection

    Sik

  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Hi @Anonymous 

    To diagnose this problem, I would first check that PowerApps can find the target record that you want to update.

    To do this, I would add a label to your screen and set the Text property to this:

    First( Filter( '[dbo].[dbo_ft]'; fno=Value(DataCardValue13.Text) ) ).fno

    Does the label show the correct fno value? If not, this is where the problem lies.

     

    @Anonymous - in case you're interested, in certain non English locales, the semi-colon character is the correct alternative to the comma character. There are some more details here...

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Combining-2-actions-for-a-Button/td-p/84030 

  • Community Power Platform Member Profile Picture
    on at

    Hi @timl ,

     

    When set the label properties with the expression

    First( Filter( '[dbo].[dbo_ft]'; fno=Value(DataCardValue13.Text) ) ).fno

    it doesn´t show the correct value.

    But if point just just to the value field:

    Value(DataCardValue13.Text)

    the correct value appears.. So the problem is with the filter expression for the DB.

    Any suggestion for the diagnose?

    Thank You

  • Community Power Platform Member Profile Picture
    on at

    The SELECT query in SQL shows me the correct row to filter:

    SELECT *
    FROM dbo.ft
    WHERE fno=20000068

  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Hi @Anonymous 

    Some of the things I would try are...

    If you hardcode the criteria value into the Filter expression, does that return the correct fno value?

    First( Filter( '[dbo].[dbo_ft]'; fno=20000068) ) ).fno

    Alternatively, you could try using the LookUp function instead of First/Filter. Does that make a difference?

    LookUp( '[dbo].[dbo_ft]'; fno=20000068)

    Just to clarify the table name in your previous message (ie SELECT * FROM dbo.ft), could confirm that your table you want to use is '[dbo].[dbo_ft]', rather than '[dbo].[ft]'?

  • Community Power Platform Member Profile Picture
    on at

    Hi @timl ,

     

    With the Lookup funcion works just fine. Thank´s

     

    Patch( '[dbo].[dbo].[ft]'; LookUp('[dbo].[dbo].[ft]'; fno=Value(DataCardValue13.Text) ) ; {fref:"2"})

     

    But now i'm receiving the error message when i execute the button request:

    "The target table of DML Statement Cannot have any enabled trigger if the statement contains an output clause without INTO clause."

    Do you know if in tables with triggers we can execute this procedures?

    Thank You

  • Verified answer
    timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Hi @Anonymous 

    Unfortunately, PowerApps doesn't support SQL Server tables with queries so I think that's the cause of the problem.

    There's a post in the ideas forum that you can vote on.

    https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Using-SQL-Trigger-on-On-Prem-where-PowerApps-updates-columns/idi-p/334328 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard