cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Filter Datatable with Text Boxes and Dropdown

Hi All,

 

i have been having very frustrating issues trying to make this datatable filter and display the results i want.

 

ronanf16_0-1572431756907.png

this will be a simple database for soil samples in a tree nursery.

 

The spreadsheet this is connected to is called Table1, the dropdown to filter by nursery location is Dropdown1_1 and this will need to filter NURSERY_Column2 as it is named on the datatable or NURSERY on the spreadsheet. TextInput1_1 will need to filter PLOT_Column1 or PLOT in the spreadsheet. TextInput13 will need to filter SUB-POLT_Column1 or SUB-PLOT in the spreadsheet. 

 

it will need to have the functionality to display all records relating to the nursery of the other two fields are left blank. both nursery and plot are filled in it will need to show all results for the sub-plots relating to these fields.

 

please any help would really be appreciated as I've tried every formula i could find.

 

ronanf16_1-1572432375910.png

 

Thanks in advance,

Ronan.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Filter Datatable with Text Boxes and Dropdown

@ronanf16 

Hello there!  Lets take a look at this together.  This is what your code currently looks like...

 

Search(
    Search(
        Filter(
            Table1,
            NURSERY_Column2 = Dropdown1_1.Selected.Value
        ),
        TextInput1_1.Text,
        PLOT_Column1
    ),
    TextInput13.Text,
    'SUB-PLOT_Column1'
)

 

There's a few changes to be made here...

  • Table1 should be changed to the datasource for the table instead (e.g. Sharepoint List)
  • Table columns should be changed to the datasource columns (e.g. PLOT_Column1 to column name is SP List)
  • SP List columns should have double quotes when used in the search function

 

Here's what that would look like

 

Search(
    Search(
        Filter(
            your_SP_list_name,
            NURSERY = Dropdown1_1.Selected.Value
        ),
        TextInput1_1.Text,
        "PLOT"
    ),
    TextInput13.Text,
    "SUB-PLOT"
)

 

To implement this solution you must make a collection of the records being searched.  Put this code in the OnSelect property of your button.

 

ClearCollect(
    mySearchResults,
    Search(
        Search(
            Filter(
                your_SP_list_name,
                NURSERY = Dropdown1_1.Selected.Value
            ),
            TextInput1_1.Text,
            "PLOT"
        ),
        TextInput13.Text,
        "SUB-PLOT"
    )
)

 

Then use the colllection in the Items property of your Table

 

mySearchResults

 

When the button is pressed the data table will update with the new result set.

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this posthelpful consider giving it a "Thumbs Up."

View solution in original post

4 REPLIES 4
Highlighted
Super User
Super User

Re: Filter Datatable with Text Boxes and Dropdown

@ronanf16 

My suggestion would be to  use the formula below to reduce the results set multiple times.  You'll have to substitute all of the datasource, column and control names for your own though.

 

Search( 
   Search(
        Filter(
            your_datasource_name,
            Nursery = ComboBox_Nursery.selected.value
        ),
        TextInput_Plot.Text,
        "Plot"
    ),
    TextInput_SubPlot.Text,
    "Subplot"
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Helper I
Helper I

Re: Filter Datatable with Text Boxes and Dropdown

this is still not working for me, here's what i have a s my formula, is there anything else i should change? 

 

Search(Search(Filter(Table1,NURSERY_Column2 = Dropdown1_1.Selected.Value),TextInput1_1.Text,PLOT_Column1),TextInput13.Text,'SUB-PLOT_Column1')

 

it is telling me this is an invalid argument type.

Highlighted
Super User
Super User

Re: Filter Datatable with Text Boxes and Dropdown

@ronanf16 

Hello there!  Lets take a look at this together.  This is what your code currently looks like...

 

Search(
    Search(
        Filter(
            Table1,
            NURSERY_Column2 = Dropdown1_1.Selected.Value
        ),
        TextInput1_1.Text,
        PLOT_Column1
    ),
    TextInput13.Text,
    'SUB-PLOT_Column1'
)

 

There's a few changes to be made here...

  • Table1 should be changed to the datasource for the table instead (e.g. Sharepoint List)
  • Table columns should be changed to the datasource columns (e.g. PLOT_Column1 to column name is SP List)
  • SP List columns should have double quotes when used in the search function

 

Here's what that would look like

 

Search(
    Search(
        Filter(
            your_SP_list_name,
            NURSERY = Dropdown1_1.Selected.Value
        ),
        TextInput1_1.Text,
        "PLOT"
    ),
    TextInput13.Text,
    "SUB-PLOT"
)

 

To implement this solution you must make a collection of the records being searched.  Put this code in the OnSelect property of your button.

 

ClearCollect(
    mySearchResults,
    Search(
        Search(
            Filter(
                your_SP_list_name,
                NURSERY = Dropdown1_1.Selected.Value
            ),
            TextInput1_1.Text,
            "PLOT"
        ),
        TextInput13.Text,
        "SUB-PLOT"
    )
)

 

Then use the colllection in the Items property of your Table

 

mySearchResults

 

When the button is pressed the data table will update with the new result set.

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this posthelpful consider giving it a "Thumbs Up."

View solution in original post

Highlighted
Helper I
Helper I

Re: Filter Datatable with Text Boxes and Dropdown

thats worked a treat, thanks a million!!

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,431)