Just sharing a simple example of applying a formula to the Combo box Items property, which includes Sort, Distinct, and Filter (If).
Below is our Combo Box bound to a lookup field of type Customer. If Contact is the option selected in the radio control, we want to show Contact’s Full Name sorted else Account’s Account Name field.
If( radioBtnCustomer.Selected.Value = "Contact", Sort(Distinct(Filter(Contacts,Status = 'Status (Contacts)'.Active),'Full Name'), Value, SortOrder.Ascending ), Sort(Distinct(Filter(Accounts,Status = 'Status (Accounts)'.Active),'Account Name'), Value, SortOrder.Ascending ) )
The result –
Also to clear the selection in the combo box when the user changes the option from contact to account and vice versa we can use the Reset function.
Check the below links to learn more about working with Customer lookup –
Hope it helps..
One thought on “Using Sort, Distinct, Filter together for combo box Items– Canvas Apps (Dataverse)”