cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Using a distinct dropdown list - need to include an "All" choice

I have a gallery and a dropdown that has a distinct list from a SharePoint column. However, I am in need for an "All" selection so that the entire gallery can be selected instead by a single list item.

 

Distinct('Sharks Database','N# Approved')

6 REPLIES 6
TimRohr
Level 10

Re: Using a distinct dropdown list - need to include an "All" choice

The old database trick to this to include a single row above the list, then code around whatever value you would profer as this "All". Applying this to PowerApps, you would have to use a Collect() statement to collect a single record (your all), followed by your Distinct('Sharks Database'...) set.

 

ClearCollect(SharkList, {'N# Approved': "All"}, Distinct('Sharks Database','N# Approved').'N# Approved')

 

That would put a single line entry above the set of records coming from your datasource.

 

NOTES:

1) This particular construction would only return 1 field to the dropdown. You can remove the dot-field notation from the Distinct statement to return the entire set of fields, but in that case I would add those fields into the "All" record that you are adding, first. Better if all of the fields are present in all records. Funny things can happen if they are not.

2) If you wanted to sort your returns coming from the datasource (your "Sharks Database"), wrap the Distinct() statement in a SortByColumns() rather than the entire collection, so you don't sort your "All" record down below something like "Adam".

3) How you use this item in selecting/processing items from the Gallery is separate, depending on how you structure your record.

Anonymous
Not applicable

Re: Using a distinct dropdown list - need to include an "All" choice

@TimRohr Thanks for the info, but I got the red squiggly lines. error.jpg

TimRohr
Level 10

Re: Using a distinct dropdown list - need to include an "All" choice

Those lines are under the part of the ClearCollect() statement where you decide on a name for your new Collection. You're not using an existing name, are you? We're making a new collection.

 

Since it is new, let's keep the name simple and space free. It makes typing it easier, later.

 

So if your datasource is named "Sharks Abroad Credit Transfer Database", we are going to get those records and add one at the top, but we're going to store them in a new object... in a Collection called... you pick...

SharksAbroadCollection

ApprovedPlusAll

myAwesomeCollection

HanShotFirst

Anonymous
Not applicable

Re: Using a distinct dropdown list - need to include an "All" choice

@TimRohr The bolded area is where the red lines are now.

 

ClearCollect(ApprovedPlusAll, {'N# Approved': "All"}), Distinct('Sharks Abroad Credit Transfer Database','N# Approved')

TimRohr
Level 10

Re: Using a distinct dropdown list - need to include an "All" choice

Without knowing what the error is, I would say you've most likely put this action statement into a property (like Items) that expects a Table output.

 

Put this ClearCollect statement on the screen's OnVisible event. Trigger the statement by navigating away from the screen, then back. Now that you have filled the collection, you can assign the ApprovePlusAll collection to be the source of your dropdown.

TopShelf-MSFT
Level 10

Re: Using a distinct dropdown list - need to include an "All" choice

Thanks for posting in the community @Anonymous - can you review the latest reply and advise if you need further help?

 

@TopShelf-MSFT

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,403)