Skip to main content

Filter Gallery by Title or ID from Text Input box and Dropdown Including "Select All" option. Power Apps

 





To filter list of active inventory by 2 conditions I connected gallery to 2 controls: Text input for text and ID search and Dropdown to narrow down the warehouse. Of course if the manager doe not have access to view folder for Warehouse 2 inventory, the search will not return any value.
App creates collection, OnSelect property for "Get Item from inventory" button,

ClearCollect(
             ColWarehouse,
             {Title: "Select All"},
             SortByColumns(Filter('Org Structure',ItemType.Value="Warehouse"),"Title",SortOrder.Ascending).Title)

         And the result of this collection set as Item property for Dropdown1.  

ColWarehouse

There is a very simple coding for txtInventorySearch text input . I set Reset(Self)  OnSelect.
And Gallery Items property contains the most formulae.

Sort(If(Dropdown1.Selected.Title="Select All"&&IsBlank(txtInventorySearch.Text),
    Filter(Inventory,(Sold="N"||Sold="R")),
If(Dropdown1.Selected.Title="Select All"&&!IsBlank(txtInventorySearch.Text), 
    If(IsError(Value(txtInventorySearch.Text)),
        Filter(Inventory,(Sold="N"||Sold="R")&& StartsWith(Title,txtInventorySearch.Text)),
        Filter(Inventory,(Sold="N"||Sold="R")&&ID=Value(txtInventorySearch.Text))),
 If(Dropdown1.Selected.Title<>"Select All"&&IsBlank(txtInventorySearch.Text),
    Filter(Inventory,(Sold="N"||Sold="R")&&Warehouse.Value=Dropdown1.Selected.Title),
    If(IsError(Value(txtInventorySearch.Text)),
        Filter(Inventory,(Sold="N"||Sold="R")&& StartsWith(Title,txtInventorySearch.Text)&&Warehouse.Value=Dropdown1.Selected.Title),
        Filter(Inventory,(Sold="N"||Sold="R")&&ID=Value(txtInventorySearch.Text)&&Warehouse.Value=Dropdown1.Selected.Title))))),ID)





If you wish to say thank you please donate to the charity I use to work for.

Donate here

Comments