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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Updating a different S...
Power Apps
Unanswered

Updating a different SQL table using checkboxes

(0) ShareShare
ReportReport
Posted on by 118

Good Morning,

 

I am new to PowerApps, in my latest app I have two SQL server connections. (one is a table and one is a view)

In my table, there is one field called PickResult which is int datatype. I need to update the values for this field using a submit button. The checkboxes in my gallery pull from a different SQL view than the table I want to update.

If PICK is checked then the PickResult value will become 1, if the FAIL is checked then the PickResult value will be 0. 

It is possible to do this?

Thank you

Categories:
  • eka24 Profile Picture
    20,925 on at

    On the OnCheck of the Pick;

    Patch(Datasource, ThisItem,
    {PickResult: Value (Lable1.Text)+1})

     

    On the OnCheck of the Fail;

    Patch(Datasource, ThisItem,
    {PickResult: Value (Lable1.Text)-1})

     

    Change label1 to the actual name of the label inside the Gallery

    ------------

    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.

  • ebraga Profile Picture
    118 on at

    The SQL view I'm pulling into the gallery does not have the column that I need to update in my SQL table. I want the check boxes to be able to push the updates into the 'PickResults' column with either a 1 or  0.

  • haroldk Profile Picture
    Microsoft Employee on at

    if there is only a single choice you may want to use a Radio button. Checkboxes allow for multiple selections.

    Assume you have a Radiobutton controls with the items property this:  ["Pick","Fail"]

    Then in the update property of the Picklist Fields you could use this logic

    If(Radio1.Selected.Value="Pick",1,0)

     

  • ebraga Profile Picture
    118 on at

    I have made it so users can only select one check box at a time. . The idea is that after the user checks off each of line items with either pick or fail, they would click on the button which would then update the SQL table. 

     

     

    ebraga_0-1598459559905.png

     

  • eka24 Profile Picture
    20,925 on at

    Did you try the formula. Is the issue Resolved?

    ------------

    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.

  • ebraga Profile Picture
    118 on at

    I tried the formula and the issue did not resolve. The gallery (the SQL view)  and the table that I want to update do not have the same columns (or 'label') names. I'm looking to update all the check box data to the SQL table at once instead of invidually. Please refer to the other comments I have posted here. Thank you

  • haroldk Profile Picture
    Microsoft Employee on at

    I have connected a gallery to a SQL View and the coding is very much simplified, but it shows how this can be done.

    haroldbk_msft_0-1598479842390.png

    the OnCheck property of the Checkboxes looks like this

    UpdateContext({varPick:1});
    Collect(colResults,{BusEntID:ThisItem.BusinessEntityID,PickResult:varPick,LastName:ThisItem.LastName})

    After all the selections are completed there is a Submit button to save the values in the collection to a  SQL table

    ForAll(colResults,Patch('[dbo].[Results]', Defaults( '[dbo].[Results]'),{BusEntID:BusEntID,LastName:LastName,PickResult:PickResult}))

  • ebraga Profile Picture
    118 on at

    Thank you a bunch, this helped a lot. My only question is, how can I make it so the items that have been updated to the SQL table to be removed from the collection?

  • haroldk Profile Picture
    Microsoft Employee on at

    You can change the expression to lookup to the expressions

    ForAll(colResults,Patch('[dbo].[Results]', LookUp('[dbo].[Results]',BusEntID=BusEntID) ,{BusEntID:BusEntID,LastName:LastName,PickResult:PickResult}))

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 394 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

Last 30 days Overall leaderboard