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

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
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
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."

ronanf16
Level: Powered On

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.

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

ronanf16
Level: Powered On

Re: Filter Datatable with Text Boxes and Dropdown

thats worked a treat, thanks a million!!

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,083)