Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

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

Posted on by 361

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?

  • Sormick Profile Picture
    Sormick 361 on at
    Re: Need to store a variable and get the stored number at the launch of the app

    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.

  • Pstork1 Profile Picture
    Pstork1 64,014 on at
    Re: Need to store a variable and get the stored number at the launch of the app

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

  • Verified answer
    v-jefferni Profile Picture
    v-jefferni on at
    Re: Need to store a variable and get the stored number at the launch of the app

    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
    Pstork1 64,014 on at
    Re: Need to store a variable and get the stored number at the launch of the app

    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.

  • Sormick Profile Picture
    Sormick 361 on at
    Re: Need to store a variable and get the stored number at the launch of the app

    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
    Pstork1 64,014 on at
    Re: Need to store a variable and get the stored number at the launch of the app

    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.

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,487

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,014

Leaderboard