I have a dropdown that I want to change the source of based on a radio selection. Items property of the dropdown is set to the collection SystemNumbers. I have a table with 3 different columns that correspond to the 3 different radio options. When I select the 1st option, it correctly displays the items in the dropdown, but the other 2 radio options display a ton of blank records.
Here's what that looks like:
Here is the code I am using currently in the OnSelect function of the radio button:
ClearCollect(SystemNumbers, Switch(
SiteSelector.Selected.Value,
"AAA",Filter(SystemLookup[@AAA], Len(AAA)>6),
"BBB",Filter(SystemLookup[@BBB], Len(BBB)>6),
"CCC",Filter(SystemLookup[@CCC], Len(CCC)>6)
))
For reference, if I set the items property of the dropdown directly to BBB or CCC like this, it works correctly:
Filter(SystemLookup[@BBB], Len(BBB)>6)
For whatever reason the switch statement (I've also tried with IF statements) causes issues. Has anyone seen anything like this or know how to fix it?
This worked! I enclosed it in the ClearCollect statement I had originally, and then once I initialized the collection SystemNumbers with the column name "Value" it started switching the dropdown correctly. Thank you so much for the help!
Collect(SystemNumbers, {Value: ""});
Can you give a try like below:
ClearCollect(SystemNumbers,
Switch(
SiteSelector.Selected.Value,
"AAA", Filter(SystemLookup, !IsBlank(AAA)),
"BBB", Filter(SystemLookup, !IsBlank(BBB)),
"CCC", Filter(SystemLookup, !IsBlank(CCC))
)
)
@kochbd - the column names need to be consistent. Consider using RenameColumns (not delegable):
Switch(
SiteSelector.Selected.Value,
"AAA",
RenameColumns(
Filter(
SystemLookup,
Len(AAA) > 6
),
AAA,
Value
),
"BBB",
RenameColumns(
Filter(
SystemLookup,
Len(BBB) > 6
),
BBB,
Value
),
"BBB",
RenameColumns(
Filter(
SystemLookup,
Len(CCC) > 6
),
CCC,
Value
)
)
WarrenBelz
146,635
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional