Forum Discussion

MBarnum's avatar
MBarnum
Copper Contributor
May 18, 2024
Solved

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

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. SortByColum...
  • Rob_Elliott's avatar
    May 19, 2024

    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.

     

     

    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)

     

Resources