web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Problem - Container wont show on app load as value blank

(0) ShareShare
ReportReport
Posted on by

I have a container that will not show when the app loads onto homescreen, this is because its blank. In order for it to show it needs to be true, however, this means it willl always show, and if i set it to true which will result in there being two containers squashed on the screen. I have tried the below to check if its blank, and the set it to true if blank etc. 

 

UpdateContext({showNM:If(showNM = Blank(), true, If(showNM = true, true, If(showNM = false, false)),false))

 

However, this does not work, i think it is due to using "UpdateContext" within the visible attribute.

 

Thank you

I have the same question (0)
  • M_Ali_SZ365 Profile Picture
    1,110 on at
    Re: Problem - Container wont show on app load as value blank

    Hi @PowerNovice ,

    1. Initialize your variable correctly on app start.
    2. Set the container's Visible property based on this variable.

    First, set up your context variable when the app starts. This is usually done in the OnStart event of the app:

     

    Set(showNM, true);

     

     

    Next, for the container's Visible property, simply reference this variable:

     

    showNM

     

    This means when the app loads, showNM is set to true, so your container will show. When showNM is false, the container will be hidden.

    If you want to toggle this variable within the app, use a button or some other control with the following code:

     

    UpdateContext({showNM: !showNM});

     

     This will switch showNM between true and false each time the button is pressed. Remember, UpdateContext is used for local variables, and Set is used for global variables that are accessible across screens.

    Please accept this solution if it resolves the issue. ✅
    Best regards,
    Muhammad Ali

  • PowerNovice Profile Picture
    on at
    Re: Problem - Container wont show on app load as value blank

    Hi @M_Ali_SZ365

     

    I tried initialising the variable at the start but it was a throwing an error, the only thing thats different on this example from the first way i tried is before the long way i posted on this, is you've done "!showNM" whereas i set that to true or false. 

     

    I'll give your way a go now. Thank you! 

  • PowerNovice Profile Picture
    on at
    Re: Problem - Container wont show on app load as value blank

    @M_Ali_SZ365 i now remember why i deleted that way of doing it, it duplicates the navigation menu in the sidebar. It also doesnt show the container that i need it to. 

  • M_Ali_SZ365 Profile Picture
    1,110 on at
    Re: Problem - Container wont show on app load as value blank

    Hi @PowerNovice 

    In This Code

    The code UpdateContext({showNM: !showNM}) is used to toggle a variable called "showNM" between true and false. If "showNM" is currently true, it will become false, and if it's currently false, it will become true. Make sure to initialize "showNM" with an initial value,

    Use the same button for true or false 
    Please accept this solution if it resolves the issue. ✅
    Best regards,
    Muhammad Ali

  • M_Ali_SZ365 Profile Picture
    1,110 on at
    Re: Problem - Container wont show on app load as value blank

    Hi @PowerNovice 

    t seems you're facing issues with duplicating the navigation menu and the container not displaying correctly. To fix this:

    1. Check the code that toggles "showNM" to ensure it's not affecting the navigation menu.
    2. Review the container's visibility condition, which should be set to showNM.
    3. Verify the container's position and other conditions that control its visibility.

    These steps should help you resolve the problems and achieve the desired behavior without unintended side effects.

  • PowerNovice Profile Picture
    on at
    Re: Problem - Container wont show on app load as value blank

    I think the problem for duplication is because i am initializing the nav menu in onstart as well, but it doesnt make sense because im also doing set(varUser,User()) with no problems at all.

     

    PowerNovice_1-1699519277473.png

     

     

  • M_Ali_SZ365 Profile Picture
    1,110 on at
    Re: Problem - Container wont show on app load as value blank

    Hi @PowerNovice ,

    Try This Code

    // Initialize the 'showNM' variable in the OnStart event
    Set(showNM, false);
    
    // Use this in the Visible property of your container
    Visible = showNM
    
    // To toggle visibility of the container, use the following in a button's OnSelect event
    UpdateContext({showNM: !showNM});
    
    // Ensure the navigation menu is not duplicated by checking before collecting items
    If(IsEmpty(colNavMenuItems), 
     Collect(colNavMenuItems, {
     ScreenName: "Home",
     Screen: LandingScreen
     // ... add other menu items here
     })
    );
    
    // Set the user variable without causing duplication
    Set(varUser, User());

    Please accept this solution if it resolves the issue. ✅
    Best regards,
    Muhammad Ali

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 686 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 433 Super User 2025 Season 2

#3
wolenberg_ Profile Picture

wolenberg_ 266 Moderator

Last 30 days Overall leaderboard