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 / How do i save my varia...
Power Apps
Unanswered

How do i save my variable for a browser app

(0) ShareShare
ReportReport
Posted on by 6

Actually i have a variable called hourly count in the app which is storing the hourly count of people entering a particular venue, but when i close the app, it goes back to zero..i want to retain it's value

So i am using a button to submit my count to excel, which has venue name , hourly count , the hour (time) and total count for the day...

What the app is doing is as soon as i increment using my button...it stores the count next to that venue for that hour using patch....if the hour changes , then a new entry is made for that hour but if the hour is same it keeps updating the count in that previous row only. Now suppose my hourly count for 4pm to 5pm is 60 , i close the app and start counting again....I want it to increment from 60 onwards only but it starts from 0 again....even in excel 

I want a solution for web browser app

Categories:
I have the same question (0)
  • AhmedSalih Profile Picture
    6,680 Moderator on at

    Hello, @Nehalv2000, you probably need to use a global variable that will get the last record for the current venue and hour from your Excel data source when the app starts, and then set your hourly count variable to that value.

     

    Use something like in the App.OnStart:

    Set(hrCount, 
     LookUp(
     ExcelTableName, 
     Venue = currentVenue && Hour = Hour(Now()),
     HourlyCount
     )
    )

     

    If my reply helped you, please give a  👍 , & if it solved your issue, please give a 👍 & Accept it as the Solution to help other community members find it more.

    I am primarily available on weekdays from 6-10 PM CT and 5-10 PM CT on weekends.

    Visit my Blog: www.powerplatformplace.com

    Visit my YouTube Channel: https://www.youtube.com/@powerplatformplace/videos

     

     

  • Nehalv2000 Profile Picture
    6 on at

    @AhmedSalih, i tried this but for some reason it is not taking any value in the new variable being created, it's just blank

  • AhmedSalih Profile Picture
    6,680 Moderator on at

    @Nehalv2000, to debug this, check the Hour(Now()) in a Text label. Make sure it is the same value that was patched in the excel file. 

  • Nehalv2000 Profile Picture
    6 on at

    Wait i will upload the code that i am using to store the enteries in my excel, then please see and let me know...because i tried everything i could yet it does not function 

     

     

    Collect(

        EntriesCollection,

        {

            'Haunted House': HH1,

            Date: Today(),

            Hour: Text(times),

            '10 Min Duration':Text(tentime),

            '10 Min Count': 5,

           'Hourly Count': 5,

           'Total Count':5

           

        }

    );

     

    UpdateContext({ HourlyCount: Sum(Filter(EntriesCollection, 'Haunted House'= HH1,Hour= Text(times)),'Hourly Count') });

    UpdateContext({ DailyCount: Sum(Filter(EntriesCollection, 'Haunted House'= HH1,DateValue((Date)) = Today()), 'Total Count') });

    UpdateContext({ TenCount: Sum(Filter(EntriesCollection, 'Haunted House'= HH1,Hour= Text(times),'10 Min Duration'=Text(tentime)),'10 Min Count') });

     

    If(

         IsEmpty(

            Filter(

                NT,

                'Haunted House' = "HH1" && '10 Min Duration'=Text(tentime) && DateValue((Date)) = Today()

            )

        ),

        Patch(

            NT,

            Defaults(NT),

            {

           'Haunted House': "HH1",

            Date: Today(),

            Hour: Text(times),

            '10 Min Duration':Text(tentime),

            '10 Min Count':TenCount,

           'Hourly Count': HourlyCount,

            'Total Count': DailyCount

            }

        ),

     

     

        UpdateIf(

            NT,

           

            'Haunted House'= "HH1"&& Hour= Text(times) &&'10 Min Duration'=Text(tentime)&& DateValue(Text(Date)) = Today(),

            {

            '10 Min Count':TenCount,

             'Hourly Count': HourlyCount,

            'Total Count': DailyCount

           

            }

        )

    );

     

     

     

     

     

     

     

       

    This is the code to store 10 min count , hourly count and total count

    Then to 

     

  • Nehalv2000 Profile Picture
    6 on at

    Also i have a very large dataset, so it shows error on lookup function that it may not function properly 

  • AhmedSalih Profile Picture
    6,680 Moderator on at

    @Nehalv2000, that is going to be a delegation issue. You will have to use SharePoint list to overcome this issue. Then use filter function to filter by the day, then run a lookup against the filtered dataset. 

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard