cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

Setting a Global Variable to a Boolean Value

 

How do you set a global variable to a boolean value? Currently in my app's OnStart property I have the following formula that is not working. 

Set(VarChkC,false)

All of the documentation I can find shows how to set a GV to text or value. The documentation also mentions that a GV can be set to a boolean value, but I can't find any examples of how to do it. 

 

The purpose of VarChkC is to set the status of a checkbox. Based on user selection, there are many ways the checkbox can be either true or false. Based on user selection, there are scenarios where VarChkC may never even come into play.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Setting a Global Variable to a Boolean Value

Hi @AGS94 

What you have there is the correct syntax for setting a global variable to a boolean value.

If it's not working from your OnStart property, have you tried re-running your OnStart code through the menu link that's shown beneath?

image.png

View solution in original post

3 REPLIES 3
Highlighted
Dual Super User II
Dual Super User II

Re: Setting a Global Variable to a Boolean Value

Hi @AGS94 

 

Set(VarChkC,false)

will create a variable of type boolean

You can check its type if you go to View tab -> variables > Global

 

To set it when checkbox is checked Set(VarChkC,true) using OnChecked method of checkbox

To set it when checkbox is unchecked Set(VarChkC,false) using OnUnChecked method of checkbox

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Highlighted
Super User III
Super User III

Re: Setting a Global Variable to a Boolean Value

Hi @AGS94 

What you have there is the correct syntax for setting a global variable to a boolean value.

If it's not working from your OnStart property, have you tried re-running your OnStart code through the menu link that's shown beneath?

image.png

View solution in original post

Highlighted
Resolver I
Resolver I

Re: Setting a Global Variable to a Boolean Value

 

Thanks for the guidance (I also was not aware of the "Run On Start").

 

I had the variable in three different locations and the others were setting it equal to a text value. I would have thought the OnStart would have forced it to boolean at least until the other Set functions were "engaged" so to speak, but apparantley not.

 

That said, I got it cleaned up such that all occurences are boolean. I now have a related issue that I will post in a new message since it is technically its own issue. Whew! Don't know why these seemingly simple boolean formulas are causing me so much problems!

 

Thanks again for the guidance.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published 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 (6,708)