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 / Missing Column in Gall...
Power Apps
Answered

Missing Column in Gallery Records

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am losing a column from data source to gallery items in the below code. I am not sure why this is, as all other columns from the data source seem to appear in the gallery. I've also used this code for another gallery and the problem does not appear. But, when I search through the available fields for ThisItem. in the gallery, one field does not show up that is in the source. Anyone know what's going on? 

 

Code:

With(
{
Reports: If(
NoLinksOnly,
//show only reports missing links
Filter(
Sort(
Sort(
Search(
REPORT_DETAIL_MISSING_OBJECT_LINKS,
TextInput_ReportSearch.Text,
"Report_Name"
),
Report_EDW_Project_Name
),
Report_Name
),
Report_EDW_Project_Name in ComboBox_EDWProject.SelectedItems
),
//show all reports
Filter(
Sort(
Sort(
Search(
REPORT_DETAIL,
TextInput_ReportSearch.Text,
"Report_Name"
),
Report_EDW_Project_Name
),
Report_Name
),
Report_EDW_Project_Name in ComboBox_EDWProject.SelectedItems// this shouldn't cause delegation issues since it's the same data source
)
)
},
ForAll(
Sequence(CountRows(Reports)),
Patch(
Last(
FirstN(
Reports,
Value
)
),
{RowNo: Value}
)
)
)

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    What is your source??  You have two different datasources in your Items property.

    This is a bad thing for PowerApps as it always has to infer the schema of the records for the results.  Since you have TWO different datasources, it is only going to introduce issues.

     

    If you want to have two (or more) different data sources, then you need to establish a common schema between the two sources within your formula.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @RandyHayes Oh good to know, thank you. I am using two different sources because I would like to present two different datasets depending on the radio button selection a user makes.

    How would I establish a common schema between them in my formula?

     

    I am using multiple data sources in a similarly built gallery and I am not running into the missing column issue. I have a feeling it may be due to my nested sorting since I noticed the issue after I introduced that bit of code. Would that make sense to you?

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Very possible.  It is all up to the inferences that PowerApps makes with the datasources.

    It will "try" to match schemas and provide something, but if it cannot, then it will not have what you want.  If you "happen" to get it to guess what you want, then there is always a very good chance that it will fail in play mode.

     

    Take for example a gallery with an Items property of:

    If(Checkbox2.Value,
     Table({Item: "X"}),
    
     Table({Value: 1})
    )

    What would the resulting schema be?  Well, if you look at what PowerApps guesses, then it is actually nothing.

    And, if you place a control in the gallery and refer to ThisItem.  there will be nothing to choose from because it could not infer a schema.

     

    NOW...to really appreciate this, one would think "if I re-establish the schema to be common between the two, then it will work!" - well...sort of!

     

    So, you change the formula to:

    If(Checkbox2.Value,
     ForAll(Table({Item: "X"}), {MyCol: Item}),
    
     ForAll(Table({Value: 1}), {MyCol: Value})
    )

    So now, each condition will return a table with a MyCol column.

     

    HOWEVER, PowerApps likes to be strict!  It will look at that and still not infer a schema.  It will still not consider that the result is a table with a MyCol column record.  This is because in the first, the columns are Text.  And in the Second, the columns are Numeric!!

     

    But, changing the formula to:

    If(Checkbox2.Value,
     ForAll(Table({Item: "X"}), {MyCol: Item}),
    
     ForAll(Table({Value: 1}), {MyCol: Text(Value)})
    )

    This will have a common schema and PowerApps will know that the result is a table with a record with MyCol.

     

    So, you need to apply this logic with your multiple datasources.

    With({Reports: 
     If(NoLinksOnly, 
     ForAll(
     SortByColumns(
     Search(
     Filter(REPORT_DETAIL_MISSING_OBJECT_LINKS, Report_EDW_Project_Name in ComboBox_EDWProject.SelectedItems),
     TextInput_ReportSearch.Text, "Report_Name"
     ),
     "Report_EDW_Project_Name", Ascending,
     "Report_Name", Ascending
     ),
     {ID: ID, 
     Report_Name: Report_Name,
     Report_EDW_Project_Name: Report_EDW_Project_Name
     }
     ),
     
     ForAll(
     SortByColumns(
     Search(
     Filter(REPORT_DETAIL, Report_EDW_Project_Name in ComboBox_EDWProject.SelectedItems),
     TextInput_ReportSearch.Text, "Report_Name" 
     ),
     "Report_EDW_Project_Name", Ascending,
     "Report_Name", Ascending
     ), 
     {ID: ID, 
     Report_Name: Report_Name,
     Report_EDW_Project_Name: Report_EDW_Project_Name
     }
     )
     )
     },
     
     ForAll(
     Sequence(CountRows(Reports)),
     Patch(Index(Reports, Value), {RowNo: Value})
     )
    )

     Technically, this can all be simplified as well, but I left it a bit "lengthy" to demonstrate each part for you.

     

    The above will provide a common schema for the gallery.

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hey, @RandyHayes. Thanks for the clarification! I did not know this about Power Apps and inferred schemas, but will be sure to incorporate this now and in the future for better practice. 

     

    However, I realized that this was not causing my issue. What was actually causing it was the fact that I had renamed a column in the table, but forgot to rename the same column in the view 😅. So this was causing the column (as renamed) to not appear. Updating the view column name to match the table column name solved my issue.

     

    Thanks for your time and help! 

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard