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

Filter data source using 2 search fields

I'm trying to filter my gallery by 2 different items.

Here is the code: (the user can type into search text box to filter on any of the fields in qoutes)

SortByColumns(Search('[dbo].[Pharmacy]',TextSearchBox1.Text,"PharmacyName","BdcOwner","ConsultantOwner","City","State","ZIPCode","NPI","StreetAddress"),"PharmacyName",Descending)

 

BUT, I need to integrate a filter on the entire data set regardless of what they search for.

&& Search('dbo.Pharmacy',"0",SuppressInd)

This is to look at the SuppressInd column, which contains a 1 or 0, and only display those records that are not suppressed.

Right now, i get errors.

 

Can anyone find a way to integrate the 2?

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Power Apps
Power Apps

Re: Filter data source using 2 search fields

The Search function returns a "table" with the records filtered by the condition you passed. You can nest multiple search calls in the same expression, searching on the result of another search call:

SortByColumns(
    Search(
        Search('dbo.Pharmacy',"0",SuppressInd),
        TextSearchBox1.Text,
        "PharmacyName",
        "BdcOwner",
        "ConsultantOwner",
        "City",
        "State",
        "ZIPCode",
        "NPI",
        "StreetAddress"),
    "PharmacyName",
    Descending)

 If the column "SuppressInd" contains only the values 0 or 1, you can also use a Filter expression:

SortByColumns(
    Search(
        Filter('dbo.Pharmacy', SuppressInd = "0"),
        TextSearchBox1.Text,
        "PharmacyName",
        "BdcOwner",
        "ConsultantOwner",
        "City",
        "State",
        "ZIPCode",
        "NPI",
        "StreetAddress"),
    "PharmacyName",
    Descending)

View solution in original post

1 REPLY 1
Highlighted
Power Apps
Power Apps

Re: Filter data source using 2 search fields

The Search function returns a "table" with the records filtered by the condition you passed. You can nest multiple search calls in the same expression, searching on the result of another search call:

SortByColumns(
    Search(
        Search('dbo.Pharmacy',"0",SuppressInd),
        TextSearchBox1.Text,
        "PharmacyName",
        "BdcOwner",
        "ConsultantOwner",
        "City",
        "State",
        "ZIPCode",
        "NPI",
        "StreetAddress"),
    "PharmacyName",
    Descending)

 If the column "SuppressInd" contains only the values 0 or 1, you can also use a Filter expression:

SortByColumns(
    Search(
        Filter('dbo.Pharmacy', SuppressInd = "0"),
        TextSearchBox1.Text,
        "PharmacyName",
        "BdcOwner",
        "ConsultantOwner",
        "City",
        "State",
        "ZIPCode",
        "NPI",
        "StreetAddress"),
    "PharmacyName",
    Descending)

View solution in original post

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,361)