cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Do checkboxes have to be connected to a field in a datasource or can it function independently setting a variable to true or false?

Hi,

 

Do checkboxes have to be connected to a field in a datasource or can it function independently setting a variable to true or false?

 

Thanks a lot!

 

Regards,

 

Daniel

1 ACCEPTED SOLUTION

Accepted Solutions
SunnyB
Frequent Visitor

Hi Daniel,

 

A checkbox can either update a field in the data source as you mention, or you could use the OnCheck, OnUncheck and OnSelect properties to update a local variable to true/false

 

For example
Set OnCheck -

UpdateContext({LocalVar: true})

Set OnUncheck - 
UpdateContext({LocalVar: false})

 

Thanks

View solution in original post

5 REPLIES 5
SunnyB
Frequent Visitor

Hi Daniel,

 

A checkbox can either update a field in the data source as you mention, or you could use the OnCheck, OnUncheck and OnSelect properties to update a local variable to true/false

 

For example
Set OnCheck -

UpdateContext({LocalVar: true})

Set OnUncheck - 
UpdateContext({LocalVar: false})

 

Thanks

Anonymous
Not applicable

@SunnyB , Many thanks this is great!

RandyHayes
Super User
Super User

@Anonymous 

Just as a follow on - You can simply refer to a checkbox to determine its value.  You don't need to use consuming variables to determine a checkbox value.

ex.  Checkbox1.Value  will be either true or false when you reference it in your app.  So, for example, if you have a TextInput and a Checkbox1 and you set the Visible of the TextInput to : Checkbox1.Value then the TextInput would only be visible when the checkbox is checked.

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
askondo
Community Support
Community Support

@SunnyB @RandyHayes Thanks for always helping to keep the forum active. Please keep up the good work.

Anonymous
Not applicable

@RandyHayes , many thanks! This simplifies things greatly. 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,174)