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