cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
timl
Super User III
Super User III

Question about the Set function

Hi, Could someone please explain in practical terms, the meaning of these sentences from the documentation?

 

https://powerapps.microsoft.com/en-us/tutorials/function-set/

 

"PowerApps are based on formulas that automatically recalculate as the user interacts with an app. Global variables don't offer this benefit and can make your app harder to create and understand."

 

------------------------------------------------------------------------------------------------

My interpretation of what this says is this. Suppose I have a label with the text property set to this:

 

Label1.Text = MyGlobalVariableValue

 

I then add a button and set the OnSelect action to this:

 

Set(MyGlobalVariableValue, "Hello World")

 

According to what I think the documentation says, this should not work because global variables don't participate in dynamic formula recalculations. However, this isn't the case because I've tested this scenario and it works. When I click the button, the label shows the text "Hello World".

 

This documentation conveys some warning about using global variables and I'd like to understand what that is. Could someone explain the benefit that global variables don't offer, and how they can make my app harder to create and understand?

 

Many thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
v-yamao-msft
Community Support
Community Support

Hi timl,

 

There is another documentation about Global variable, please check the part “Create a global variable” in this documentation for more details:
https://powerapps.microsoft.com/en-us/tutorials/working-with-variables/

 

But about documentation on the benefit that global variable doesn’t offer and how it makes app harder to create and understand, so far I haven’t seen a related one.

 

If you have any questions when using Set() function, please feel free post your issues here. About the disadvantages of Global variable, I will keep an eye on it and try to find some related information.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yamao-msft
Community Support
Community Support

Hi timl,

 

There is another documentation about Global variable, please check the part “Create a global variable” in this documentation for more details:
https://powerapps.microsoft.com/en-us/tutorials/working-with-variables/

 

But about documentation on the benefit that global variable doesn’t offer and how it makes app harder to create and understand, so far I haven’t seen a related one.

 

If you have any questions when using Set() function, please feel free post your issues here. About the disadvantages of Global variable, I will keep an eye on it and try to find some related information.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (43,292)