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 / Checkbox value saving ...
Power Apps
Answered

Checkbox value saving to SQL database

(0) ShareShare
ReportReport
Posted on by

Good day

I have a few checkboxes who's value must save to a SQL database:

janineb_0-1673943207411.png

This is the code behind the Submit button (SelectedRecord is the variable):
Patch(SelectedRecord, {'WATCHLIST RISK INCLUSIVE': WListInclusiveDD.SelectedText.Value, 'Economic Risks': EconomicRiskChk.Value, 'Business Risks': BusinessRiskChk.Value, 'Financial Risks': FinRiskChk.Value, 'Credit Risk Migration': CreditRiskMitChk.Value, 'Covenant Breaches': CovenantBreachesChk.Value, 'Other Material Breaches': OtherChk.Value, 'WATCHLIST RISK COLOUR': WListRiskColourDD.SelectedText.Value, HI_CapturedBy: CapturerTxt.Text, HI_DateUpdated: CaptureDate.SelectedDate}); Navigate(ThankYou)

 

I am however getting the following error:

janineb_1-1673943370504.png

 

The field types in SQL is "Bit" (and I have also tried "Int"), but somehow I keep getting the error on a few of the Risk fields.  Can you perhaps advise me what I am doing wrong?

 

Thank you

Categories:
I have the same question (0)
  • janineb Profile Picture
    on at

    I managed to workaround the error by changing the checkbox fields to 'Business Risks': Text(BusinessRiskChk.Value).  Is this acceptable?

  • janineb Profile Picture
    on at

    My workaround is not working 😞

     

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @janineb ,

     

    These columns are of type Text, what values would you like to save in the table? You have different check boxes for respective columns, say EconomicRiskChk is checked, then what will be saved in 'Economic Risks' column?

     

    Generally speaking, we will design the table with a single column named "Risk Types", then populate this column with a checked value. But for your scenario, I think risk types could be multiple. So, Please try and use below formula:

    Patch(SelectedRecord, {'WATCHLIST RISK INCLUSIVE': WListInclusiveDD.SelectedText.Value, 'Economic Risks': If(EconomicRiskChk.Value,"Y","N"), 'Business Risks': If(BusinessRiskChk.Value,"Y","N"), 'Financial Risks': If(FinRiskChk.Value,"Y","N"), 'Credit Risk Migration': If(CreditRiskMitChk.Value,"Y","N"), 'Covenant Breaches': If(CovenantBreachesChk.Value,"Y","N"), 'Other Material Breaches': If(OtherChk.Value,"Y","N"), 'WATCHLIST RISK COLOUR': WListRiskColourDD.SelectedText.Value, HI_CapturedBy: CapturerTxt.Text, HI_DateUpdated: CaptureDate.SelectedDate}); Navigate(ThankYou)

     

    So, if a check box is checked, corresponding column will be Y, otherwise N.

     

    Best regards,

  • janineb Profile Picture
    on at

    Thank you for your kind assistance

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
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard