cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
mandy4514
Level: Powered On

how to use a dropdown and a text box to search a gallery

On my Browse screen I need a dropdown or combo box that has a list of all fields in the list.  Then to take a text box text and search the selected field in the gallery below.  How can I set the dropdown or combo box to all fields in a SharePoint list?

(1) This is a drop down with a set list of all columns in list

(2) This is a text box to search the gallery below

(3) This is the gallery that should look to the dropdown to choose which field to filter by what a user is typing.

 

Any and all help appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: how to use a dropdown and a text box to search a gallery

Hi @mandy4514 ,

Could you please share a bit more about your scenario?

Do you want your Gallery to look to the dropdown to choose which field to filter by what a user is typing?

Do you want to specify the filter column dynamically from the Dropdown box?

 

Based on the needs that you mentioned, I afraid that there is no direct way to achieve your needs. As an alternative solution, I think the If function/Switch function could achieve your needs.

 

I have made a test on my side, please take a try with the following workaround:

Set the Items property of the Gallery to following formula:

Switch(
           Dropdown1.Selected.Value,
           "SiteID",
           Filter('YourSPList', TextSearchBox1.Text in SiteID),
           "Name",
           Filter('YourSPList', TextSearchBox1.Text in Name),
           "Store",
           Filter('YourSPList', TextSearchBox1.Text in Store),
           "Address",
            Filter('YourSPList', TextSearchBox1.Text in Address),
            ...
            ...
            ...
)

or

Switch(
           Dropdown1.Selected.Value,
           "SiteID",
           Filter('YourSPList', StartsWith(SiteID, TextSearchBox1.Text)),
           "Name",
           Filter('YourSPList', StartsWith(Name, TextSearchBox1.Text)),
           "Store",
           Filter('YourSPList', StartsWith(Store, TextSearchBox1.Text)),
           "Address",
            Filter('YourSPList', StartsWith(Address, TextSearchBox1.Text)),
            ...
            ...
            ...
)

If you use If function, please type the following formula:

Filter(
          'YourSPList',
           If(
               Dropdown1.Selected.Value ="SiteID",
               TextSearchBox1.Text in SiteID,
               Dropdown1.Selected.Value ="Name",
TextSearchBox1.Text in Name,
Dropdown1.Selected.Value ="Store",
TextSearchBox1.Text in Store,
...
... ) )

Note: Currently, specifing the Filter column dynamically from a Dropdown box within the Filter function is not supported within PowerApps.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
RezaDorrani
Level 10

Re: how to use a dropdown and a text box to search a gallery

Hi @mandy4514 

 

You cannot dynamically define the column for filtering

 

When you are filtering the gallery, you would have to do the following

 

Switch(drpdown.selected.Value, "Column1", Filter(datasource, Column1 = searchtxt.Text),"Column2", Filter(datasource, Column2 = searchtxt.Text),"Column3", Filter(datasource, Column3 = searchtxt.Text), and so on)

 

So you would practically have to right all the filter choice options in your dropdown in the formula above to achieve your requirement

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Community Support Team
Community Support Team

Re: how to use a dropdown and a text box to search a gallery

Hi @mandy4514 ,

Could you please share a bit more about your scenario?

Do you want your Gallery to look to the dropdown to choose which field to filter by what a user is typing?

Do you want to specify the filter column dynamically from the Dropdown box?

 

Based on the needs that you mentioned, I afraid that there is no direct way to achieve your needs. As an alternative solution, I think the If function/Switch function could achieve your needs.

 

I have made a test on my side, please take a try with the following workaround:

Set the Items property of the Gallery to following formula:

Switch(
           Dropdown1.Selected.Value,
           "SiteID",
           Filter('YourSPList', TextSearchBox1.Text in SiteID),
           "Name",
           Filter('YourSPList', TextSearchBox1.Text in Name),
           "Store",
           Filter('YourSPList', TextSearchBox1.Text in Store),
           "Address",
            Filter('YourSPList', TextSearchBox1.Text in Address),
            ...
            ...
            ...
)

or

Switch(
           Dropdown1.Selected.Value,
           "SiteID",
           Filter('YourSPList', StartsWith(SiteID, TextSearchBox1.Text)),
           "Name",
           Filter('YourSPList', StartsWith(Name, TextSearchBox1.Text)),
           "Store",
           Filter('YourSPList', StartsWith(Store, TextSearchBox1.Text)),
           "Address",
            Filter('YourSPList', StartsWith(Address, TextSearchBox1.Text)),
            ...
            ...
            ...
)

If you use If function, please type the following formula:

Filter(
          'YourSPList',
           If(
               Dropdown1.Selected.Value ="SiteID",
               TextSearchBox1.Text in SiteID,
               Dropdown1.Selected.Value ="Name",
TextSearchBox1.Text in Name,
Dropdown1.Selected.Value ="Store",
TextSearchBox1.Text in Store,
...
... ) )

Note: Currently, specifing the Filter column dynamically from a Dropdown box within the Filter function is not supported within PowerApps.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mandy4514
Level: Powered On

Re: how to use a dropdown and a text box to search a gallery

@v-xida-msft Thank you this helps but not all fields I need to search by are text, lookups, dates, choice, Rich text, true/false (toggle) and a slider. I am struggling to account for the other field types.

 

As to your begining questions: 

Do you want your Gallery to look to the dropdown to choose which field to filter by what a user is typing? Yes but not all are text fields

Do you want to specify the filter column dynamically from the Dropdown box? Yes I have gotten all the column names in the dropdrop manually with just a bracket table. It is not linked to the actual fields. 

 

I am using your second option of the switch and it is working only on text fields.

Switch(DDSearch.Selected.Value,"Name",Filter('[dbo].[Location]',StartsWith(Name,SearchText1.Text)),"SiteID",Filter('[dbo].[Location]',StartsWith(SiteID,SearchText1.Text)),"Store",Filter('[dbo].[Location]',StartsWith(Store,SearchText1.Text)),"Address",Filter('[dbo].[Location]',StartsWith(Address,SearchText1.Text)),"Country",Filter('[dbo].[Location]',StartsWith(Country,SearchText1.Text)),"City",Filter('[dbo].[Location]',StartsWith(City,SearchText1.Text)),"State",Filter('[dbo].[Location]',StartsWith(State,SearchText1.Text)),"Region",Filter('[dbo].[Location]',StartsWith(Region,SearchText1.Text)),"DesignLead",Filter('[dbo].[Location]',StartsWith(DesignLead,SearchText1.Text)),"SiteAdapt",Filter('[dbo].[Location]',StartsWith(SiteAdapt,SearchText1.Text)),"RDProgram",Filter('[dbo].[Location]',StartsWith(RDProgram,SearchText1.Text)),"Phase",Filter('[dbo].[Location]',StartsWith(Phase,SearchText1.Text)),"DDReceived",Filter('[dbo].[Location]',StartsWith(DDReceived,SearchText1.Text)))

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 50 members 4,586 guests
Please welcome our newest community members: