web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Combo Box to show list...
Power Apps
Unanswered

Combo Box to show list of persons from Sharepoint list Person or Group Column (Multi choice) and use it to filter a Gallery

(0) ShareShare
ReportReport
Posted on by 11

Hello, I know this would be a basic thing, but after exploring all the options from online I'm writing here.

 

1. I have a Sharepoint list "Tracker" with Person or Group column "Lead" which is a multi-choice field. I want to connect it to a combo box showing only the list of persons DisplayName from the sharepoint list.

2. Also, I've other two Buttons set to a variable varLocation, onselect set to "India" and varStatus onselect set to "Completed". Based on the variables values, I also need to filter the list of persons' showing in the combo box.

2. Once multiple persons are selected from the combo box, the same needs to be filtered in the Gallery items which contains a field of Persons' DisplayName.

 

Someone please guide me as this is getting delayed for very long.

Categories:
I have the same question (0)
  • Akah Mandela Profile Picture
    445 on at

    Let’s break down the steps to achieve what you’re looking for:

    1. Combo Box for Person or Group Column: follow these steps:

      • Set the Items property of the combo box to:
        Distinct('Tracker', Lead.DisplayName)
        This will populate the combo box with unique display names from the 'Tracker' list.
    2. Filtering Based on Variables: You mentioned having two buttons (varLocation and varStatus) that affect the filtering. Assuming you want to filter based on both variables:

      • Set the Items property of the combo box to:
        Filter(
         Distinct('Tracker', Lead.DisplayName),
         Location = varLocation && Status = varStatus
        )
        Replace Location and Status with the actual column names in your SharePoint list that correspond to the location and status values.
    3. Filtering Gallery Items: To filter the gallery items based on the selected persons from the combo box:

      • Set the Items property of your gallery to:
        Filter(
         'YourGalleryDataSource',
         Lead.DisplayName in ComboBox.SelectedItems.Result
        )
        Replace 'YourGalleryDataSource' with the actual data source for your gallery.
  • Verified answer
    RogierE Profile Picture
    875 Moderator on at

    This is a tough cookie! 🙂 

    So presuming that 'Location' and 'Status' are also columns in the Tracker list, I got my go at creating a mockup App for your case. The toughest thing is that you can have multiple Leads in every record of your Tracker list, as you have chosen for the multi-choice person/group column in SharePoint. And if the same person is chosen for multiple records in your Tracker list, you do not want them to show multiple times in your Combo box.

    The second hard thing is that Location and Status are properties of the records in your Tracker list, but will be used for filtering Leads in your ComboBox. 

     

    So in the OnStart of your App or the OnVisible of your screen you should create a collection figuring these combinations out. I did that like this: 

     

    Clear(colLeads);
    ForAll(
        Tracker,
        ForAll(
            Lead,
                Collect(
                    colLeads,
                    AddColumns(Table(ThisRecord),Location,Tracker[@Locatie],Status,Tracker[@Status])
                )
        )
    );
    So first I run through all records in the Tracker, and through all leads of that Record, and add them to a collection 
    And then I  add 2 columns looking up the Location and Status of the record where we found the Lead. 
     
    Now you can add the colLeads to the Items of your Combobox and select Displayname in the Fields selector. But before you do, you would want to filter the Combobox to Location = "India" and Status = "Completed" if the buttons you mentioned were pressed. (hope you don't forget to also clear varLocation and varStatus if the user presses the button a second time). And you would want to prevent multiple occurances of the same Lead
    So this would lead to the following code in the Items property of the ComboBox: 
     
    Distinct(Filter(colLeads,Location=varLocation || IsBlank(varLocation), Status=varStatus || IsBlank(varStatus)),DisplayName)
     
    where the || Isblank takes care that everyting is shown if no location or status is selected. 
    And then, closing up, you can add the following to your Gallery Items to only show things in MyList that have the DisplayName in the Title column. 
     
    Filter(MyList,Title in ComboBox1.SelectedItems.Value)
     
    Note: you can copy my code directly, but there might be slight value, source, naming and lannguage differences. So it is better to follow my lead but write/check the code yourself.
     
    Please LIKE the reply and ACCEPT it as the solution if the answer is what you were looking for.
    (to help me grow in community rank and help others find the solution)
     
  • RVivek Profile Picture
    11 on at

    Thank you so much @RogierE. You saved my day.

     

    The combo box and filtering works perfectly fine.

    The only concern is while filtering the Gallery Items, it shows error as below.

    RVivek_0-1713607885216.png

    The error in the Value is Can't convert this data type. Power Apps can't convert this Table to a Text.

    I believe I missed something.

  • Verified answer
    RogierE Profile Picture
    875 Moderator on at

    Ah, okay. Didn't know that the list you wanted to filter was theTracker list itself. So if I understand correctly you want to show the Filtered list of Tracker records where one of the leads you chose is in one of the leads of the records. 

    Nice one! You can not do that in a single filter as you have to compare a table to a table looking for matches. What you can do is add this to the OnChange of your ComboBox:

     

    Clear(colGallery);
    ForAll(ComboBox1.SelectedItems,Collect(colGallery,Filter(Tracker,Value in Tracker[@Lead].DisplayName)))
     
    So now you run through the selected Leads and check in every Tracker record if that person is one of the leads for the record, and if so add it to a collection. 
     
    You can then add colGallery to the Items property of your Gallery. 
  • RVivek Profile Picture
    11 on at

    You're a Savior ! Thanks a lot.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard