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 / Gallery not displaying...
Power Apps
Unanswered

Gallery not displaying drop down options when source gallery data is collection and doesn't have data.

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I'm new to Power Apps. We have created a collection of data that displays several values from a SQL database, including measurement and status for an item.  We have a gallery with the collection as the source data and it has two drop-down options for a measurement and status for an item.  If that particular piece selected in PA has information in the collection (i.e. measurement and status have already been selected and thus shows in the collection) the two drop-downs show this information correctly and the LOV show and can be changed.  However, if there hasn't been a measurement or status selected yet, there is no information in the collection and the drop-downs do not appear in the gallery.  Is there a way to show the gallery drop-downs when information is not in the collection that the gallery data source is going after?  Essentially this is a scenario where a user would go into this particular item and would need to select the measurement and status from a drop-down which will then populate back to the SQL database and appear in the collection.  It works for items that already have items with measurements and statuses in the collection.

 

Here is the Item property on the Gallery:

Filter(Tbl_piece_exceptions_per_cast,varPiecePK = PIE_Pieces_PK && ExceptionCategoryID = 1)

  • tbl_piece_exceptions_per_cast = collection
  • PIE_Pieces_PK = item we have selected
  • ExceptionCategoryID = the ID that needs to be filtered to show on the gallery. 
    • This is the problem - the ExceptionCategoryID does not yet exist in the Collection and thus the gallery goes blank and doesn't show the two drop-down options to choose from.  We need it to show the two drop-down options so a value can be chosen by the user.

Thanks!

 

Categories:
  • Hassan_SZ_365 Profile Picture
    542 on at

    Hi @msamuelson ,

     

    Ensure Default Data for Dropdowns: Create a separate collection that holds the default dropdown values that should be displayed when there is no data for an item.

     

    // Run this on app start or when initializing your screen
    ClearCollect(colDefaultDropdownValues, {Measurement: "", Status: ""})

     

    Configure the Gallery: Use the Coalesce function to display data from your main collection or the default collection when no data is present.

     

    // Use this in the Items property of the gallery
    Coalesce(
     Filter(Tbl_piece_exceptions_per_cast, varPiecePK = PIE_Pieces_PK && ExceptionCategoryID = 1),
     colDefaultDropdownValues
    )

     

    Set Up Dropdowns in Gallery: For each dropdown inside the gallery, you will bind the Items property to your SQL data source for measurements and status values.

    Use Conditional Logic for Dropdown Default Values: If the main collection is empty for the selected item, the dropdown should default to the first item or a placeholder from the SQL data source.

     

    // Use this in the Default property of the dropdown
    If(
     IsEmpty(Filter(Tbl_piece_exceptions_per_cast, varPiecePK = PIE_Pieces_PK && ExceptionCategoryID = 1)),
     First(SQLDataSource).ColumnName, // Replace with your SQL Data source and column name
     ThisItem.ColumnName // Replace with actual column name from the collection
    )

     

    Handling Dropdown Selection: Write code to handle the user's selection from the dropdown to update the SQL database and refresh the collection. You will likely use the Patch function or a similar method for this.
    Remember to replace SQLDataSource, ColumnName, Tbl_piece_exceptions_per_cast, and other placeholders with the actual names from your app's data structure.

     

    Best Regards,

    Hassan Raza

  • RRCORTEZ Profile Picture
    7 on at

    @Hassan_SZ_365 

     

    I work with @msamuelson and we are trying to figure this out together. I was able to write the code for our app and I will paste it all below, but we are still running into issues if there are no values/exceptions causing the gallery to not appear.

     

    App OnStart: We put in default values as below

    ClearCollect(colDefaultDropdownValues, {Measurement: "0.000", ExceptionStatusDescription: "Not Repaired"})

     

    Gallery's Items:

    Coalesce(
    Filter(Tbl_piece_exceptions_per_cast, varPiecePK = PIE_Pieces_PK && ExceptionCategoryID = 1),
    colDefaultDropdownValues
    )

     

    For our measurement dropdown we have 

    If(
    IsEmpty(Filter(Tbl_piece_exceptions_per_cast, varPiecePK = PIE_Pieces_PK && ExceptionCategoryID = 1)),
    First(Tbl_piece_exceptions_per_cast).Measurement, // sql Data source
    ThisItem.Measurement
    )

     

    for our status ID dropdown we have

    If(
    IsEmpty(Filter(Tbl_piece_exceptions_per_cast, varPiecePK = PIE_Pieces_PK && ExceptionCategoryID = 1)),
    First(Tbl_piece_exceptions_per_cast).ExceptionStatusDescription,
    ThisItem.ExceptionStatusDescription // sql Data source
    )

     

     

    so even before we get to using "OnChange" or a patch function we went to test a panel that has no exception to display, and the gallery is still absent. if it has an exception it appears normally when the app is ran. Any idea?

     

    thanks for your time,

    Rob

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 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard