cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AGS94
Level 8

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
Super User
Super User

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
Dual Super User
Dual Super User

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.

Super User
Super User

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

AGS94
Level 8

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,386)