Hello
I need to have a dropdown populate its items from a collection
I have a Sharepoint list - Site where the name of a Site is stored in Title
So I load this into a collection. This list has
ClearCollect(
SiteCollection,
Site
);
My edit form has a variable with the property SiteName
This is a lookup and so is shown as a dropdown
What do I set Items, DisplayName and DisplayValue to?
This complains saying that Title is not valid
If I set it to just SiteCollection it doesn't work either?
Please can someone help?
Cheers
Paul
Solved! Go to Solution.
Is it possible to do this with a SharePoint Person column? I'm trying to create a dropdown control with distinct values from a collection column. The collection is created from a SharePoint list and the source column is a Person datatype. I'd like to display distinct DisplayNames from that Person column.
If the Person column in SP is single, not multi-select, this formula will provide a distinct list of names and, unlike the evil Distinct() function, maintain the person metadata in case you need their email etc. later in the app.
This example collection is created from the SP list 'ppl testing'. This list has a single person column called 'testUserPPL'. To create the collection:
ClearCollect(colPPL,'ppl testing')
In the dropdown.Items:
SortByColumns(GroupBy(ForAll(colPPL,testUserPPL),"DisplayName","_myPPLGroup"),"DisplayName")
Now, if you need to know the selected person's email, you simply have to reference the _myPPLGroup table, no need to LookUp/Filter/Search SharePoint to fetch info you already have:
In label.Text:
First(Dropdown2.Selected._myPPLGroup).Email
If you must Distinct(), here is that meh formula:
Distinct(ForAll(colPPL,testUserPPL.DisplayName),Value)
Further, if you have a multiselect ppl column(testUsersPPLMulti), Ungroup works its magic:
Sort(Distinct(ShowColumns( Ungroup(colPPL, "testUsersPPLMulti"), "DisplayName"),DisplayName),Result)
Cheers!
@AaronKnox are you kidding me?? You're being the Sherlock from across the PowerApps Community?!? Thank you again, you beautiful genius! 🙂
You're welcome, @RacRig5407!
To prevent anyone reading this from going down the Distinct() path, here is the GroupBy() version of the multiselect ppl column:
Sort(GroupBy(Ungroup(colPPL, "testUsersPPLMulti"),"DisplayName","_myGroupTable"),DisplayName,Ascending)
User | Count |
---|---|
121 | |
87 | |
87 | |
75 | |
66 |
User | Count |
---|---|
215 | |
180 | |
138 | |
96 | |
82 |