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 / Auto Populating Gallery
Power Apps
Unanswered

Auto Populating Gallery

(0) ShareShare
ReportReport
Posted on by 26

Hello, 

I have a gallery that leads to a sharepoint. The gallery is populated based on 4 dropdowns that relate to the columns of the sharepoint. I would like to make the gallery auto populate when the first two dropdowns are filled in rather than all 4 being required to fill in. I would like to still have the other 2 dropdowns required and want the data to autopopulate in the gallery beginning when the first dropdown is selected.

 

My gallery items code is :

Filter('datasource',
'status'.Value = TextInput1.Text,
'coulmn1'.Value = dopdown1.Selected.Result,

'coulmn2'.Value = dopdown2.Selected.Result,

'coulmn3'.Value = dopdown3.Selected.Result,

'coulmn4'.Value = dopdown.Selected.Result,
)

 

This basically sets a filter so the only items that populate have a specific status and then it filters based on the dropdown results. All 4 must be filled in, I would like it so after the first one is filled in it would start populating and narrow down as more dropdowns are filled in. 

 

 Thank you. 

Categories:
I have the same question (0)
  • One Profile Picture
    416 on at

    if you want to filter a gallery based on multiple dropdown selections it will take a rather lengthy 'If' statement. you will want something similar to the following *in the Items property of your gallery:

    If(
    IsBlank('YourComboBoxName1'.Selected.Result) && IsBlank('YourComboBoxName2'.Selected.Result),
    'Your SP List Name',
    IsBlank('YourComboBoxName2'.Selected.Result) && !IsBlank('YourComboBoxName1'.Selected.Result),
    Filter(
    'Your SP List Name',
    'YourComboBoxName1'.Selected.Result = 'Review Status'.Value
    ),
    IsBlank('YourComboBoxName1'.Selected.Result) && !IsBlank('YourComboBoxName2'.Selected.Result),
    Filter(
    'Your SP List Name',
    'YourComboBoxName2'.Selected.Result = Requestor.DisplayName
    ),
    !IsBlank('YourComboBoxName1'.Selected.Result) && !IsBlank('YourComboBoxName2'.Selected.Result),
    Filter(
    'Your SP List Name',
    'YourComboBoxName2'.Selected.Result = 'SP List Column1'.Value && 'YourComboBoxName1'.Selected.Result= 'SP List Column2'.Value
    )
    )

     this has only been written for 2 dropdowns, but it's the same concept for 4. you just add a couple more 'If' statements to include more dropdowns and it will filter by ALL the dropdowns where a selection has been made. (meaning if only 1 dropdown has a selection, the gallery will filter by the 1 selection that was made. if 2 dropdowns have a selection it will filter by both, etc.)

     

    Hope this helps!

  • aleisure99 Profile Picture
    26 on at

    Is there anyway I could add a search button instead of all of these formulas and based on what is filled in it will search? I am struggling with what a few of these formulas mean- I am unsure what the requestor display name is and I am not using combo boxes just dropdowns

  • One Profile Picture
    416 on at

    @aleisure99 Yes there is, in the items property of your gallery you will want something similar to:

    Filter(
    [@'Your SP List'],
    StartsWith(
    'SP Column',
    'TextBoxToSearch'.Text
    )
    )



     

  • aleisure99 Profile Picture
    26 on at

    I mean like a button that would trigger the gallery to filter based on teh dropdowns that are filled in. Not a text input search bar. 

  • One Profile Picture
    416 on at

    There is not, because you would still need the IF statements that tell the gallery when and what items to filter.

  • aleisure99 Profile Picture
    26 on at

    Ok, 

    Attatched is my code for these dropdowns. How can I add more if statements to it? Anytime I add another it gives an error :

     

    If(IsBlank(Cooling_Dropdown_2.Selected.Result) Or IsBlank(Shape_Dropdown_2.Selected.Result),

    Filter('SBG Tracker 2',
    'Status/ Line #'.Value = TextInput1_1.Text,
    'Machine Type'.Value = Machine_Dropdown_2.Selected.Result,
    'Equipment Type'.Value = Equipment_Dropdown_2.Selected.Result),

    Filter('SBG Tracker 2',
    'Status/ Line #'.Value = TextInput1_1.Text,
    'Machine Type'.Value = Machine_Dropdown_2.Selected.Result,
    'Equipment Type'.Value = Equipment_Dropdown_2.Selected.Result,
    'Cooling Method'.Value = Cooling_Dropdown_2.Selected.Result,
    'Conical/ Parallel'.Value = Shape_Dropdown_2.Selected.Result
    )
    )

  • One Profile Picture
    416 on at

    Sorry i should have mentioned in my previous post that the IF statements will go in the Items property of your gallery, not in your dropdowns.

  • aleisure99 Profile Picture
    26 on at

    Can you help me build an if statement? I copy and pasted the one you sent (and edited to my fields) and it did not work. I also tried to build my own but anytime I added a send if statement it failed.

  • One Profile Picture
    416 on at

    @aleisure99 

    What are the data types of your SharePoint list columns that are being compared?

  • One Profile Picture
    416 on at

    @aleisure99,

    as long as you know the datatypes for your columns you should be able to adjust the following code to fit your needs.

    in the items property of your gallery:

    //if all dropdowns are blank
    If(IsBlank(Dropdown1) && IsBlank(Dropdown2) && IsBlank(Dropdown3), 'YourListName',
    //if dropdown 2 & 3 are blank
    IsBlank(Dropdown2) && IsBlank(Dropdown3) && !IsBlank(Dropdown1),Filter('YourListName', SPListColumn1.Value = Dropdown1.Selected.Result),
    //if dropdown 1 & 3 are blank
    IsBlank(Dropdown1) && IsBlank(Dropdown3) && !IsBlank(Dropdown2), Filter('YourListName', SPListColumn2.Value = Dropdown2.Selected.Result),
    //if dropdown 1 & 2 are blank
    IsBlank(Dropdown1) && IsBlank(Dropdown2) && !IsBlank(Dropdown3),Filter('YourListName', SPListColumn3.Value = Dropdown3.Selected.Result),
    //if only dropdown 3 is blank
    !IsBlank(Dropdown1) && !IsBlank(Dropdown2) && IsBlank(Dropdown3),Filter('YourListName', SPListColumn1 = Dropdown1.Selected.Result && SPListColumn2.Value = Dropdown2.Selected.Result),
    //if only dropdown 2 is blank
    !IsBlank(Dropdown1) && !IsBlank(Dropdown3) && IsBlank(Dropdown2),Filter('YourListName', SPListColumn1 = Dropdown1.Selected.Result && SPListColumn3.Value = Dropdown3.Selected.Result),
    //if only dropdown 1 is blank
    !IsBlank(Dropdown2) && !IsBlank(Dropdown3) && IsBlank(Dropdown1),Filter('YourListName', SPListColumn2.Value = Dropdown2.Selected.Result && SPListColumn3.Value = Dropdown3.Selected.Result),
    //if no dropdowns are blank
    !IsBlank(Dropdown2) && !IsBlank(Dropdown3) && !IsBlank(Dropdown1),Filter('YourListName', SPListColumn1.Value = Dropdown1.Selected.Result && SPListColumn2.Value = Dropdown2.Selected.Result && SPListColumn3.Value = Dropdown3.Selected.Result))

     there is a comment above each line explaining what that line of code is doing. this is only for 3 dropdowns so you will have to adjust for more or less dropdowns.

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard