HI,
Only because I read it a little differently than Warren will I respond, otherwise :-) I'd leave it for him same as we usually do for each other.
If you have 7 dropdowns on a Form.
This is what I would do.
1. In each of the Dropdowns OnChange I would add this, but where it says Dropdown = 1, you simply put in the Number 1-7 as you have 7 so that the Collection can know which specific Selection is adding the Value to our SelectionCounts collection
So you end up with a Table that has records like
{
Dropdown: 1,
Value: TheTextValue of the chosen value in the Dropdown. IF the dropdown already has a value, it does an update, if not it adds it. So you end up with 7 Rows in this Collection once they have selected values in all 7
}
If(IsEmpty(SelectionCounts) Or IsBlank(LookUp(SelectionCounts, Dropdown = 1)),
Collect(SelectionCounts, { Dropdown: 1, Value: Text(Self.Selected.Value) });
,
UpdateIf(SelectionCounts, Dropdown = 1, {Value: Text(Self.Selected.Value) });
);
Now in the DisplayMode of the Save Button I would put
If(CountRows(Filter(SelectionCounts, Value = "1")) > 1
Or CountRows(Filter(SelectionCounts, Value = "2")) > 1
Or CountRows(Filter(SelectionCounts, Value = "3")) > 1,
DisplayMode.Disabled,
DisplayMode.Edit
)
This checks to see if the Value 1 or 2 or 3, has more than 1 Row in the collection and if so it sets the DisplayMode to Disabled.
Of course you should always have IsBlank checks to make sure that they actually picked 7 values, in addition to the DisplayMode code I added.
I selected 1 twice and it disabled the button.
or with different ones
Or if you want to display a Message to them, then you can put the code thats in the button OnSelect
If(CountRows(Filter(SelectionCounts, Value = "1")) > 1
Or CountRows(Filter(SelectionCounts, Value = "2")) > 1
Or CountRows(Filter(SelectionCounts, Value = "3")) > 1,
DisplayMode.Disabled,
DisplayMode.Edit
)
into the OnChange of every dropdown, after the other OnChange code runs... or just disable the button as I have here.
Anyway, I could have read it wrong as i mentioned so apologies if I did, but I was going for 7 separate dropdowns on a form