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 not set corre...
Power Apps
Answered

Variable not set correct on start

(0) ShareShare
ReportReport
Posted on by 10

I have a problem with showing and hiding icons. 

 

I have a variable called EditRep. I have three icons i'm setting different visabilities and type of icon. 

 

I have an Edit icon that has an OnSelect value of

 

UpdateContext({EditRep: !EditRep})

On the type of Icon I have the following

If(EditRep, Icon.Cancel, Icon.Edit)

I have a delete icon with the visibility set to 

EditRep

I have a save icon with the visiblity set to 

DeleteIco.Visible

My issue is when the powerapps page loads, both delete and save show and the edit/cancel icon is set to edit. It's like EditRep is set to true for the save and delete but false for the edit/cancel icon. 

 

I do have a couple other UpdateContext in the form to set the values back to false, but those are on the delete OnSelect and Save OnSelect. Should I change those to !EditRep instead of false?

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

    This is usually an issue with timing.  I've solved it in the past by using global variables and setting them in a Splash screen rather than ONStart.  That usually makes sure they are set before the first regular screen loads.

  • dmowry Profile Picture
    10 on at

    Is there a way to have a splash screen act as a loading screen? Meaning, as the app loads, it shows a spinner, after the app is load then it sets the variable? 

     

    Just not sure how to set the global variable so that it's false after everything has loaded?

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

    The point is to set the variables the way they should be for the initial load of the app while the splash screen is displayed.  Once that is done then show the first screen, which will now reflect the initial value of the variable.  And yes, you can display a spinner on the Splash screen.  But Splash screens are normally loaded based on a timer.  I'm not sure how you would determine that the app was loaded so you could dismiss the Splash screen.

  • Verified answer
    RezaDorrani Profile Picture
    12,145 on at

    Hi @dmowry 

     

    created same scenario as you described and it works

     

    Is there any other place where you are modifying the context variable

     

    Try doing this OnVisible of your screen

    UpdateContext({EditRep: false})

     

    Regards,

    Reza Dorrani

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

  • dmowry Profile Picture
    10 on at

    That worked. Thank you

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