cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Continued Contributor
Continued Contributor

Variable Types and Best Practice?

Hi All,

 

Quick Question. I understand the in PowerApps we can use the following variable types:

  • Global Variable (Set()) that can be used anywhere in the app. 
  • Context Variable(UpdateContext()) Local to the Screen
  • Collection (Collect()) Table Records used globally.

My Main Question is what is the benefits of using a Context Variable and passing it to another screen using Navigate() over using a global variable in the first place? Is there a performance gain?

 

At the moment I seem to using Global for all except for a temporary or counter value. I'm not sure if there is even a reason not to use Global for everything. Is there any notion of a best practice for variables?

Thanks,
Nicky

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @OneThing,

I think your thought is proper. Using a Global variable (using Set() function) has a better performance than Context variable (using UpdateContext() function) within a canvas app.

It is a performance tip for canvas app that, to pass the app’s state from one screen to another, create or modify a global variable value by using the Set function instead of by using the Navigate and UpdateContext) functions.

Please check the following article for more details:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/performance-tips#use-global-variables

 

Best regards,

Kris

Community Support Team _ Kris Dai
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

2 REPLIES 2
Community Support
Community Support

Hi @OneThing,

I think your thought is proper. Using a Global variable (using Set() function) has a better performance than Context variable (using UpdateContext() function) within a canvas app.

It is a performance tip for canvas app that, to pass the app’s state from one screen to another, create or modify a global variable value by using the Set function instead of by using the Navigate and UpdateContext) functions.

Please check the following article for more details:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/performance-tips#use-global-variables

 

Best regards,

Kris

Community Support Team _ Kris Dai
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

Continued Contributor
Continued Contributor

Hi Kris,

 

Thanks for the feedback and especially the link. I've never seen this page, and there are a few questions I've had regarding performance, that this has given me more information on.

 

Many Thanks,
Nicky 

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (51,222)