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/Update functions...
Power Apps
Answered

Patch/Update functions do not work provide different errors.

(0) ShareShare
ReportReport
Posted on by 28

Backstory: 

I have a Table named Settings - columns: SettingName, SettingValue

balys_2-1642604839006.png

 

Task: with a button push update a SQL Table colum SettingValue

 

I run several commands: 

Patch( 'Settings', Lookup( 'Settings', 'SettingName' = "EnableAllDiagnostics" ), { 'SettingValue': "1" } )

balys_0-1642604672114.png

Update(Settings,
First( Filter( Settings, SettingName="EnableAllDiagnosticPolicies" ) ), { SettingName: "EnableAllDiagnosticPolicies" ,
SettingValue: "0" } )

balys_1-1642604819013.png

 

I am new to PowerApps and I think I do a simplest mistake, could someone point me to that mistake? 

Thanks in advance 

Balys

 

 

Categories:
I have the same question (0)
  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    Your table does not have any item the name: EnableAllDiagnostics

    That is the error. It is not finding nothing beacause you dont have a setting in your SQL Tble with that name...

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,
    Gonçalo Nogueira

    Check my LinkedIn!

    Check my User Group (pt-PT)!

    Last Post on Community

    My website!

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @balys 

    Your first error is because you spelled LookUp incorrectly - that is the simple one.

     

    Your formula is better done with an UpdateIf function.

    It would be:

    UpdateIf(Settings, SettingName="EnableAllDiagnostics", {SettingValue: "1"})

     

    Same for your second formula:

    UpdateIf(Settings, SettingName="EnableAllDiagnosticPolicies", {SettingValue: "0"})

    Avoid using First(Filter - It is equivalent to LookUp except that with First(Filter PowerApps will filter ALL rows of your data and then just return one row.  With LookUp, it will return the first record it finds.  So it is much more performant.

     

    I hope this is helpful for you.

     

     

     

  • PowerSoumyo Profile Picture
    19 on at

    Where are you writing this expression? OnSelect of a button? Are there other formulae in this same action? Have you made any structural changes to the table in the SQL database (renaming/adding/removing columns/tables)?

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @balys 

    I should add...the formulas provided are for Updating records - not for creating them.

    If you need that ability, let me know and I will provide more details.

  • balys Profile Picture
    28 on at

    Hello Goncalo,

    I am thankful for your insights! 

    Now I get another error: 

    balys_0-1642680314219.png

     

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    Remove all the '

     

     

  • balys Profile Picture
    28 on at

    It worked with LookUp

  • balys Profile Picture
    28 on at

    You were right, it worked with LookUp  - Speling issue 

    And Gonçalo was also right - EnableAllDiagnosticPolicies was also spelled incorrectly

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard