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 / Need to store a variab...
Power Apps
Answered

Need to store a variable and get the stored number at the launch of the app

(0) ShareShare
ReportReport
Posted on by 566

I have a simple counter stored in a variable: Set(varCounter;varCounter+1)

If i quit my application my variable is lost.

How can i store my variable and retrieve it at the launch of my app?

Categories:
  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    To do that you'll need to use some kind of data source like SharePoint or store it and load it using SaveData and LoadData. The one problem with SaveData/LoadData is that its not supported on all platforms. Its primarily meant for use on mobile devices.

  • Sormick Profile Picture
    566 on at

    First of all, happy new year and thank you for your reply. Can we store the counter number in a sharepoint list instead? or a permanent variable or a special formula? i only need to store one number and when i click on a button it increments "+1" to that number and store it again.

  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    There is nothing like a permanent variable or a special formula. But yes, as I mentioned you can store the number in a data source like SharePoint. I mentioned LoadData and SaveData because they are easier to use for something like storing one number, if you can live with the limitations. Otherwise use SharePoint.

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Sormick ,

     

    Since it's a single number, I think you can leverage an environment variable to save the value. You can load/get the value OnStart of your App, it supports update using Patch function as well. 

     

    Please refer to below video:

    Canvas Apps: Using Environment Variables - YouTube

    and find related formula in below threads:

    Solved: How to read Environment Variables in PowerApp? - Power Platform Community (microsoft.com)

    Solved: How to update an Environment Variable value from c... - Power Platform Community (microsoft.com)

     

    Best regards,

  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    Yes, you can use an environment variable, but that will require a Premium license.

  • Sormick Profile Picture
    566 on at

    Many thanks all for your replies. I don't have a premium license. I think i will use instead a sharepoint list to store and retrieve the information needed.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 190 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard