Hi @rvdhorst ,
The 'Distinct' function in PowerApps is used to return distinct values from a data source, but it's typically applied to a collection or table of data. It might not work as expected when applied directly to the 'Choices' function, especially for a Choices column or a Lookup field. Instead, you can first retrieve the distinct values from the Choices column and then use them in your app.
Here's a step-by-step approach:
Create a Collection:
- Start by creating a collection to store the distinct values from your Choices column. You can do this in the 'OnStart' property of your app or on a specific screen.
ClearCollect(DistinctEmployees, Distinct(Choices([@'Academy-Series'].'LUP-Employees'), Value))
This code creates a collection named 'DistinctEmployees' that contains the distinct values from the 'LUP-Employees' Choices column.
Use the Collection:
- After creating the collection, you can use it in your app wherever needed. For example, if you want to populate a dropdown with the distinct employee values, set the `Items` property of the dropdown to 'DistinctEmployees'.
DistinctEmployees
SubmitForm:
- When you want to submit the form, you can use the selected value from the dropdown or any other control bound to the 'DistinctEmployees' collection. The 'SubmitForm' function should work as expected with the selected value.
By creating a collection with distinct values from the Choices column, you separate the data retrieval from the actual usage in your app, making it easier to work with the distinct values in various parts of your application.
Thanks!!!
Please consider marking my response as the accepted solution if it successfully resolves your concern. If you found the information beneficial in other aspects, kindly express your appreciation by giving it a thumbs-up.