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 / Screen doesn't display...
Power Apps
Suggested Answer

Screen doesn't display fields on first load

(1) ShareShare
ReportReport
Posted on by 1
I have a multi-screen form based on a SharePoint list. For this functionality,  a user selects an item from a gallery on a screen, that item is saved in a variable, and the form fields are displayed with the data based on that variable.
 
The first time a user loads the page, two of the fields that are dependent on a choices field do not display, even though they have data. When I go back a screen and view this screen again, the fields display correctly. The Choice field displays correctly with the data for that item on opening the screen, but the fields dependent on that choice do not load until I go back and view the item again. This only happens in the published app, not in preview mode.
 
What would cause items to not display on first load, and is there a way to fix it?
 
choice options:
Choice1, Choice2, Choice3
 
variable: 
varOptions
 
Screen OnVisible:
Set(varOptions, DataCardValue1.SelectedItems);
 
Choice Default:
ThisItem.'ChoiceColumn'.Value
 
Data Field Visible:
Field 1: If("Choice1" in varOptions.Value, true, false)
Field 2: If("Choice2" in varOptions.Value, true, false)
Field 3: If("Choice3" in varOptions.Value, true, false)
Categories:
I have the same question (0)
  • Suggested answer
    11manish Profile Picture
    3,333 on at
    The most robust approach is not to copy SelectedItems into a variable during Screen.OnVisible.
     
    Instead, base your visibility logic directly on the form's current record or the ComboBox's SelectedItems.
     
    This avoids timing issues and ensures the visibility conditions always reflect the latest data.
     
    If a variable is required, update it only after the control has finished loading (for example, in the ComboBox's OnChange or via a short timer).
  • Suggested answer
    Haque Profile Picture
    3,653 on at
    Hi @JRandZ,
     
    Seems like back and forth navigation helps to load data fully hence dependent fields display correctly.
     
    Reason-1:
    The way you have implented where varOptions is set bit too early, but the dependent field that relies on selection e.g. Choice1 in varOptions.Value not evaluated by that time as expeted.
     
    Reason-2:
    During the first load (in your published app) - varOptions is set in the OnVisible using DataCardValue1.SelectedItems, but by that time selected items (Choic control's) may not be synchronized.
     
    Possible fixes:
     
    Let's not set varOptions in OnVisible from the choice control - let's set it from the actual data, means, record's choice field value.  For example, if your form’s item is bound to a variable or gallery selection, use that value.
     
     
    We can use a formula that retrieves the choice value from the record like below, let's set it like below and update the visibility formula to handle varOptions correctly.
    Set(varOptions, varSelectedItem.'ChoiceColumn')
    If ( "Choice1" in varOptions.Value, true, false)
     
    NOTE: 'ChoiceColumn' is choice field (column) in SharePoint list that holds the choice values you want to work with.
     
     A bit different way - we can set varOptions in the form's onSuccess or after the form's Item proerty is set.
     
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
  • Suggested answer
    WarrenBelz Profile Picture
    155,838 Most Valuable Professional on at
    Hi @JRandZ,
    I will go back a step here and firstly look at the Item of the Form that this Data Card and Combo Box are in and the DefaultSelectedItems of the Combo Box DataCardValue1.
     
    So firstly, when you select a record from a Gallery, you can certainly set a Variable - something like this Global Variable example
    Set(
       gblRecord,
       ThisItem
    )
    but then make the Item of the Form (I assume you are using SharePoint here for the example)
    LookUp(
       SPListName,
       ID = gblRecord.ID
    )
    This way the Form directly queries the current stste of the record each time it opens or is reset by changing form modes.
     
    The next issue is whether you want the Visible of the text control to only action when the Form opens, or also when the user changes something in the Combo Box after it opens. You can actually cover both (the second is a bit of overkill, but should cover the gap you have) - note that you do not need If/true/false here (refer this blog of mine) - just make a statement that can be either true or false and the Visible will directly reflect the outcome. 
    gblRecord.ChoiceColumn.Value in ['Choice1", "Choice2", "Choice3"] ||
    DataCardValue1.Selected.Value in ['Choice1", "Choice2", "Choice3"]
    I am also assuming that the DefaultSelectedItems of the Combo Box is 
    ThisItem.ChoiceColumn
     
    Please ✅ Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn  

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard