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
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (6,348)