cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

Checkbox and Data Type In SQL

I couldnt find a reference...but what is the supported data source for a checkbox if the database is an Azure SQL? 

6 REPLIES 6
Highlighted
Community Champion
Community Champion

Re: Checkbox and Data Type In SQL

Hi @BrendonBrooksP1

I have successfully patched to Azure SQL bit data type using the true or false values in PowerApps.

Hope this helps.

Highlighted
Post Patron
Post Patron

Re: Checkbox and Data Type In SQL

Cool. Bit it is

 

So under the Advanced menu, would I change the OnCheck property to True and leave the default on UnCheck to False? 

 



Since I'm using Patch, I'm assuming to write to the DB you would use the following:

 

Patch('[dbo].[UsageForm]', Defaults('[dbo].[UsageForm]'), { Option1: CheckBox1, Option2: CheckBox2}) 
Community Champion
Community Champion

Re: Checkbox and Data Type In SQL

hi @BrendonBrooksP1

 

Some corrections.

 

1) There is no need for the OnCheck property unless you want to take some action when someone checks the box (i.e. for example patch immediately)  So you can leave it as blank (i.e. don't write anything) or false (i.e. take no action).  Similarly UnCheck takes action when someone unchecks the box

 

2) The correct patch syntax is this:

Patch('[dbo].[UsageForm]', Defaults('[dbo].[UsageForm]'), {Option1: CheckBox1.Value, Option2: CheckBox2.Value}) 

PS I have posted about this in many other places, but the use of Defaults slows down performance since a call will first be made to determine those defaults.  What I normally do is load the default record in a global variable with the OnStart property of the first screen and then use that global record type variable instead.

Highlighted
Post Patron
Post Patron

Re: Checkbox and Data Type In SQL

 

@Meneghino

 

So If I understand this correctly, by simply changing the OnStart property to, for example:

 

 

Set(DefaultDb, '[dbo].[Test]')

Then, PowerApps more or less sets our dbo.Test  as a default database. Now when I want to save a record, would I do this command?

 

 

Collect(DefaultDb, {Column1: Data1, Column2: Data2, Column3: Data3})

 Seems like a more efficient way of saving to a database. Thanks for your help

 

Brendon

 

Highlighted
Community Champion
Community Champion

Re: Checkbox and Data Type In SQL

Hi @BrendonBrooksP1

I am not sure that you can make a data source into a variable, actually I am pretty sure you cannot.

Variables can only store tables, records or values, I think.

Highlighted
Helper V
Helper V

Re: Checkbox and Data Type In SQL

Hi,

 

So what is option1 an option 2?

 

Patch('[dbo].[UsageForm]', Defaults('[dbo].[UsageForm]'), {Option1: CheckBox1.Value, Option2: CheckBox2.Value})

 

Are these the field names?

I have my check box field names set as "bit" in sql tables. How should I declare those in the patch()?

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (4,229)