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

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 Team
Community Support Team

Re: Variable Types and Best Practice?

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 Team
Community Support Team

Re: Variable Types and Best Practice?

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

OneThing
Level 8

Re: Variable Types and Best Practice?

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
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,663)