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 / Powerapps Refresh Problem
Power Apps
Answered

Powerapps Refresh Problem

(0) ShareShare
ReportReport
Posted on by 15

Hello, I am very new to Power Apps and I created a prototype of an app where I have an excel worksheet with a list of names in a column. In the app I have a button which displays the first name of the list by default and, when pressed, will display the next name in the list. The problem I am facing is that I can't figure out how to save the state of the button to keep the current name displayed even after a refresh. As it is the name keeps on displaying the first name after refreshing. This app is going to be improved and used by other people so any help would be appreciated. Thank you.

 

 

Categories:
  • v-hanytian-msft Profile Picture
    Microsoft Employee on at

    Hi @MatthewSaw ,

     

    Do you want to keep the current name after refresh the Browser?

    If No, Can you explain specifically the scenario you experienced?

     

    Where do you want to show the name? Is it the Text of Button?

    vhanytianmsft_0-1689910554591.png

     

     

    Can you provide more scenarios about keeping the current name displayed even after a refresh?

     

    If you can offer me some screenshot for the issue it will help us to solve it efficiently.

     

    Best Regards,

    Tina

  • MatthewSaw Profile Picture
    15 on at

    MatthewSaw_0-1689924619614.png

    I have a button such as the one posted above.

     

    MatthewSaw_1-1689924759400.png

     

     

    When I press the button it will take the user to another screen where they will confirm the process (see picture 2) and will take them back to the first screen and change the text of the button from Matthew to Jake, for example. These names are gotten from a column in an excel worksheet. 

    The problem is that whenever I refresh it changes back to Matthew, the first name in the column, but I want it to remain on Jake, or on Nathan (for example), if the user decides to repeat the process.

    Thanks

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello Matthew!

    Could you attach the code you're using to currently display the name that is shown, and the code on the button?:)

    H

  • MatthewSaw Profile Picture
    15 on at

    Text property code of Name button: 

    If(CurrentRow2 <= CountRows(Table1), LookUp(Table1, ID = CurrentRow2).Secondary, "No One")

    OnSelect property code of Name button: 

    Set(CurrentRow2, CurrentRow2 + 0);
    Navigate(PS2, ScreenTransition.None);

     

    OnSelect property of the Confirm button on screen2: 

    Set(CurrentRow2, CurrentRow2 + 1);
    Office365Outlook.SendEmail(
    LookUp(Table1, ID = CurrentRow2 + 1).Semail & "@gmail.com",
    "Testing",
    "This is a test email, please do not reply."
    );
    Navigate(Level1, ScreenTransition.None)

     

     

     

    Thanks for the help.

     

     

     

  • v-hanytian-msft Profile Picture
    Microsoft Employee on at

    Hi @MatthewSaw ,

     

    May I ask the refresh you mean is refreshing the Browser or something else?

     

    Best Regards,
    Tina

  • MatthewSaw Profile Picture
    15 on at

    Refreshing the browser, to clarify, when the app is released on mobile phones, I want the names to stay as they are between users so all users will see Jake displayed if the confirm button is pressed and it will persist even after closing the app. I am not really sure how to test this.

     

  • Verified answer
    v-hanytian-msft Profile Picture
    Microsoft Employee on at

    Hi @MatthewSaw ,

     

    In fact, variables in PowerApps are reset after the Browser refresh, so we recommend you create a new table in the data source to save the current state.

     

    Table for saving the current state.

    vhanytianmsft_1-1689928203358.png

     

    Insert a Button of the Apps.

     

    First Screen:

    OnSelect of Button:

    Set(CurrentRow2,Int(First(Table2).Number));

    Navigate(PS2, ScreenTransition.None);

     

    Text of Button.

    If(First(Table2).Number <= CountRows(Table1), LookUp(Table1, ID = Int(First(Table2).Number)).Secondary, "No One")

     

    Second Screen:

    OnSelect:

    //"Patch(Table2,First(Table2),{Number:CountRows(Table1)+1})" Make Number always stay in the same Number  

    If(Int(First(Table2).Number) < CountRows(Table1),Patch(Table2,First(Table2),{Number:CurrentRow2+1}),Patch(Table2,First(Table2),{Number:CountRows(Table1)+1}));

     

    Office365Outlook.SendEmail(
    LookUp(Table1, ID = CurrentRow2 + 1).Semail & "@gmail.com",
    "Testing",
    "This is a test email, please do not reply."
    );
    Navigate(Level1, ScreenTransition.None)

     

    After refreshing the App, it still can stay the current state.

    vhanytianmsft_4-1689928203363.png

     

    If you have any doubt, please do not Hesitate to reply to me. 

    Hope this will help you,

     

    Best Regards,

    Tina

  • MatthewSaw Profile Picture
    15 on at

    Thanks for the help, most of it doesn't give back any errors. However, the below line of code:
    If(Int(First(Table2).Number) < CountRows(Table1),Patch(Table2,First(Table2),{Number:CurrentRow2+1}),Patch(Table2,First(Table2),{Number:CountRows(Table1)+1}));

    gives me the error "Data source is either read-only or has no primary key". It is 100% not read-only so it must be the primary key, however excel doesn't seem to have that type of function?

    Thanks

  • v-hanytian-msft Profile Picture
    Microsoft Employee on at
  • MatthewSaw Profile Picture
    15 on at

    I managed to get it working with the method you provided @v-hanytian-msft, thank you for the solution, my friend.

     

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
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard