cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
aleisure99
Regular Visitor

Auto Populating Gallery

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. 

10 REPLIES 10
One
Resolver IV
Resolver IV

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
Regular Visitor

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
Resolver IV
Resolver IV

@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
Regular Visitor

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
Resolver IV
Resolver IV

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

aleisure99
Regular Visitor

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
Resolver IV
Resolver IV

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
Regular Visitor

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
Resolver IV
Resolver IV

@aleisure99 

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

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (2,145)