SOLVED

PowerApps: Filter and sort using tablist AND search bar (with 2 fields)

Copper Contributor

I have a gallery pulling from a Sharepoint List. I have a tab list set up that allows the user to select a tab, and be shown a filtered view of the list. Love that. Great. Good. Dandy.


SortByColumns( Filter( 'Sharepointlist', Or( Category.Value = TabList1.Selected.Value, TabList1.Selected.Value = "All" ) ), "Title",SortOrder.Ascending)

 

The problem is I would like to also filter the list by the search bar. As the user types I would like the list to be further filtered by what the user is typing if it matches what is in field a or field b. I have a field with the title and another field with the acronym. Some users may search using the acronym and so I need it to check both places.

 

I cannot for the life of me figure out what the code would need to be for that or how to nest it. any help is appreciated!

2 Replies
best response confirmed by MBarnum (Copper Contributor)
Solution

@MBarnum I have an app that does exactly this as shown in the attached video. There is a tab list for the initial filtering of the gallery. A user can then start typing into the filter box and the gallery will filter down based on what they are typing.

 

1-UkAirports.png

 

The filter input control is named inpFilter.

 

The items property of the gallery then has the following formula which, as you'll see uses the And so that the galleries displays records from both the tab list and the filter, but also Or (inside parenthesis) to check each of the columns for the text entered

Sort(Filter(
    colAirports,
    ISOCountry = tabCountry.Selected.Country
   And (Or(
        StartsWith(
            AirportType,
            inpFilter.Text
        ),
        StartsWith(
            GPS,
            Upper(inpFilter.Text)
        ),
        StartsWith(
            Title,
            Upper(inpFilter.Text)
        ),
        StartsWith(
            Municipality,
            Upper(inpFilter.Text)
        ),
        StartsWith(
            ISORegion,
            Upper(inpFilter.Text)
        )

    ))
),
Title,SortOrder.Ascending)

 

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)

 

@Rob_Elliott Thank you so much! This is great, going to try it now!

1 best response

Accepted Solutions
best response confirmed by MBarnum (Copper Contributor)
Solution

@MBarnum I have an app that does exactly this as shown in the attached video. There is a tab list for the initial filtering of the gallery. A user can then start typing into the filter box and the gallery will filter down based on what they are typing.

 

1-UkAirports.png

 

The filter input control is named inpFilter.

 

The items property of the gallery then has the following formula which, as you'll see uses the And so that the galleries displays records from both the tab list and the filter, but also Or (inside parenthesis) to check each of the columns for the text entered

Sort(Filter(
    colAirports,
    ISOCountry = tabCountry.Selected.Country
   And (Or(
        StartsWith(
            AirportType,
            inpFilter.Text
        ),
        StartsWith(
            GPS,
            Upper(inpFilter.Text)
        ),
        StartsWith(
            Title,
            Upper(inpFilter.Text)
        ),
        StartsWith(
            Municipality,
            Upper(inpFilter.Text)
        ),
        StartsWith(
            ISORegion,
            Upper(inpFilter.Text)
        )

    ))
),
Title,SortOrder.Ascending)

 

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)

 

View solution in original post