cancel
Showing results for 
Search instead for 
Did you mean: 

Filter condition Wildcards

Please add wildcards to use in the Filter() function.

 

Situation: I want to Filter the database with two dropdown controls. (In real life this could be more fields)

 

Solution now:

 

If(!IsBlank(ComboBox1.Selected) && !IsBlank(ComboBox2.Selected)
    ,Filter(DummyData, Column1 = ComboBox1.Selected.Result ,Column2 = ComboBox2.Selected.Result)
    ,!IsBlank(ComboBox1.Selected) && IsBlank(ComboBox2.Selected)
    ,Filter(DummyData, Column1 = ComboBox1.Selected.Result ,Column2 = ComboBox2.Selected.Result)
    ,IsBlank(ComboBox1.Selected) && !IsBlank(ComboBox2.Selected)
    ,Filter(DummyData, Column2 = ComboBox2.Selected.Result)
    ,IsBlank(ComboBox1.Selected) && IsBlank(ComboBox2.Selected)
    ,DummyData
)

 

 

Solution suggested 1:

 

Filter(DummyData, Column1 = * & ComboBox1.Selected.Result & * ,Column2 = * & ComboBox2.Selected.Result & *)

 

 

The * is the Wildcard in this example. 

 

Should work like: 

  • ComboBox1.Selected.Result & * - This should filter the combobox1 selected value against starts with.
  •  * & ComboBox1.Selected.Result - This should filter the combobox1 selected value against ends with.
  • * & ComboBox1.Selected.Result & * - This should generally work as the 'in' function, so matches all record where value starts with, ends with and in String.

When ComboBox1.Selected.Result is equal to an empty string, then this should work as select all.

 

Solutions suggested 2:

Filter(DummyData, Evaluate(Column1 = ComboBox1.Selected.Result), Evaluate(Column2 = ComboBox2.Selected.Result))

In this case the Evaluate() function should look if there is a value to match from the combobox1. If combobox1 is blank it should totally skip the logical_test. So if both evaluations are blank you just get the datasource.

 

To stay ahead off a discussion. Yes I know the Search function, but as far I know this function is build to evaluate the local dataset (so max 2000 records). This means first the dataset is collected from the source with the Filter function and then the search function is activated. Besides delegational issues, adding this functionality to the filter() function will increase speed and decrease bandwidth, simple because filtering is delegated to the datasource server and the returned dataset is already narrowed down to the nescessary records. But I don't know this for sure, but are just thinking off my head here Smiley LOL

 

Status: New
Comments
Level 10

Oke, lets add a working solutions for this issue:

 

Filter(DummyData
	,IsBlank(ComboBox1.Selected.Result) || Column1 = ComboBox1.Selected.Result
	,IsBlank(ComboBox1.Selected.Result) || Column2 = ComboBox1.Selected.Result
)

Explenation: the Filter condition part wants a true to pass. By adding the OR and IsBlank function, the output is true on the IsBlank function when the combobox is empty.

 

Also you can use a If statement:

Filter(DummyData
	,If(IsBlank(ComboBox1.Selected.Result), Column1 = ComboBox1.Selected.Result, true)
	,If(IsBlank(ComboBox2.Selected.Result), Column2 = ComboBox2.Selected.Result, true)
)

Or the switch statement:

Filter(DummyData
	,Switch(IsBlank(ComboBox1.Selected.Result), false, Column1 = ComboBox1.Selected.Result, true)
	,Switch(IsBlank(ComboBox2.Selected.Result), false, Column2 = ComboBox2.Selected.Result, true)
)

Thanks to Mr Dang from the PowerApps team for his assistance with this issue.

Level: Powered On

First of all, I want to say thank you for this great tool. PowerApps is a great tool. 

 

It would be very helpful if you could filter and sort data similar to excel. A table in Excel can be filtered by all columns. Only possible entries are displayed if filters are already set.

 

Are there plans for this?