
I have a Dropdown that I am using to filter a Gallery.
I am setting the content of the Dropdown based on the choice of a Radio control. When the user changes the Radio control the options in the Dropdown change. I've gotten to two to work independently, but I can't figure out how to combine the two.
If(ReviewGalleryFilterByRadioControl.Selected.Value="Purchasing Agent", Distinct(SMCollection,Manager)
If(ReviewGalleryFilterByRadioControl.Selected.Value="Status",["Pending","Reviewed"], If(ReviewGalleryFilterByRadioControl.Selected.Value="Event Name",["Comic Book Conference","Movie Trailer Conference"])))
I also need a forth added:
If(ReviewGalleryFilterByRadioControl.Selected.Value="Move/Television", Distinct(SMCollection,MovieTelevision)
The issue here is that you are trying to combine tables of 2 different schemas inside your DropDown. Distinct() returns a table with a column called 'Result' and using the [ ... ] approach returns a table with a column called 'Value', so we need to fix this. We can do this using RenameColumns().
Try this code
Switch(
ReviewGalleryFilterByRadioControl.Selected.Value,
"Purchasing Agent", RenameColumns( Distinct(SMCollection,Manager), "Result", "Value"),
"Status",["Pending","Reviewed"],
"Event Name",["Comic Book Conference","Movie Trailer Conference"],
"Move/Television", RenameColumns( Distinct(SMCollection,MovieTelevision), "Result", "Value")
)I also took the liberty of using Switch over If() as your code is better suited to this approach.