web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Variable Types and Bes...
Power Apps
Answered

Variable Types and Best Practice?

(0) ShareShare
ReportReport
Posted on by 393

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

Categories:
I have the same question (0)
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    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

  • OneThing Profile Picture
    393 on at

    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 

  • MichelH Profile Picture
    401 on at

    The UpdateContext function is not mentioned on the page suggested by Kris.
    I wonder what the performance of Set vs UpdateContext  is.
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard