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
Solution Sage
Solution Sage

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

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

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

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

 

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

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.

Anonymous
Not applicable

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

 

@Anonymous

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,114)