cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Filter & Search broken together

Hi,

 

Does Powerapps support nesting Search and Filter?

Currenty only a single fuinction works, as soon as there are 2 or more they do not work.

Is this intended or will this change in the future?

 

Thank you,

8 REPLIES 8
Highlighted
Power Apps
Power Apps

Re: Filter & Search broken together

Search and Filter can be nested inside each other, it should work. Depending on your data source, you may get a warning that Search does not support delegation (as is the case with SharePoint), but functionally it should work.

 

If this is not the case for you, can you please provide more details (expression used, data source, detailed error message)?

Highlighted
Anonymous
Not applicable

Re: Filter & Search broken together

Thanks for the fast reply,

 

Since you state it should work let me write down what i'm dealing with.

Both of the function work on their own and return results (500 only, but still ok)

 

Search(
CDS1,
TextInput1.Text,
"Name")

 

Filter(
CDS1,
City = "New York" || City= "Los Angeles" 

 

Let's say I want to search people in New York or Los Angeles.

If i try to nest them the Filter one does not work, just the Search

 

Search(
  Filter(
  CDS1,
  City = "New York" || City = "Los Angeles" ),

TextInput1.Text,
"Name")

 

I'm connecting to Common Data Services, and it's listed that is should support both function.

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-list

Highlighted
Super User
Super User

Re: Filter & Search broken together

Hi Gandy,

 

What happens if you put the Search() inside of the Filter()?

Highlighted
Community Support
Community Support

Re: Filter & Search broken together

Hi @Anonymous,

 

Have you tried the Startswith function?

For example:

Filter(CDS1, City="New York"|| City ="Los Angeles", 
Startswith(Name, TextInput1.Text)
)

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Anonymous
Not applicable

Re: Filter & Search broken together

Hi

 

@Drrickryp, The Search works as expected. but the filter() does not eliminate other results from the table.

So Search gives results with all cities included, ignoring the filter condition.

 

@

 

Highlighted
Super User
Super User

Re: Filter & Search broken together

Hi Gandy,

 

I tested it on one of my CDS data sources with > 2000 items and found the same thing that you did.  I'm not sure why Search() and Filter() don't play well together.  However, in the following example I used the "in" function and since it is not delegatable, I created a collection called ds and filtered that.*  I added a Dropdown box loaded with city names (Distinct,ds,City), set the Items property of my DataTable to Filter(ds,TextInput1.Text in Name && City =Dropdown1.Selected.Result). It worked perfectly.    If you want to work with the last 500 records in your datasource, I suggest creating a collection like ClearCollect(ds,FirstN(Sort(YourDataSource,ID,Descending),500)).

 

If you want to use multiple selections for City, use a ListBox set with the Select Multiple Items property set to true. Set the Items property of the DataTable to Filter(ds,TextInput1.Text in Name && City in ListBox1.SelectedItems.Result)

 

* Functions like in, not, etc are not subject to delegation limits in collections.

Highlighted
Anonymous
Not applicable

Re: Filter & Search broken together

Hi Drrickryp,

 

I need to delegate in order to get complete and therefore accurate results.

 

What is the point of having only 500 from a larger set? to see latest changes? to get a "feel" for the data from the 500 sample pool? Made the design and UI easier if you only work with a handfull of records?

None of this helps me, i can't tell clients hope your record was in the 1st 500 rows.

Anyway, noone makes a app if it will have a dozen records, they use pen and paper...

 

As i see it now this is just a new version of Infopath for tablets and phones. Great for inputing a single data record, while all other data overview or pulling is not there yet (Functional and well documented).

 

Did i misunderstand anything about Powerapps here?

 

 

Highlighted
Super User
Super User

Re: Filter & Search broken together

Hi Gandy,

 

I believe that you have underestimated what Powerapps is capable of accomplishing.  First, you can increase the default item limit from 500 to 2000 in  File - AppSettings.  Second,  I have constructed apps that include as many as 90,000 items in a table and they work almost instantly on my phone or tablet.  The key to creating complex apps from large data sources is understanding Delegation.  Delegation refers to whether a given powerapps function is applied to a local data set or is occurring over a network.  Some functions are delegatable meaning that they operate at the network level and others (non delegatable) will only work on the data brought to the device.  For example, Filter and Sort are two functions that work at the network level for almost every type of data source.  This means that they can work in seconds on hugh data sources. To quote from: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview 

"The key to building efficient apps is to minimize the amount of data that must be brought to your device. Perhaps you need only a handful of records from a sea of million, or a single aggregate value can represent thousands of records. Or perhaps only the first set of records can be retrieved, and the rest brought in as the user gestures that they want more. Being focused can dramatically reduce the processing power, memory, and network bandwidth that your app needs, resulting in snappier response times for your users, even on phones connected via a cellular network. Delegation is where the expressiveness of PowerApps formulas meets the need to minimize data moving over the network. In short, PowerApps will delegate the processing of data to the data source, rather than moving the data to the app for processing locally."  

To build more than the simplest app from a single Excel table it is important to understand where the functions operate on data.  While I have only had minimal experience with InfoPath,  I migrated a complex Access Web App that ran a doctor's office with >12,000 patients and 50,000 visits to Sharepoint lists and the Powerapps Common Data Service, created a Powerapps front end and it works great.  There are many (> 150) backend databases that work with Powerapps including Sql, Salesforce and Common Data Service to name a few.  I wouldn't give up on it until you have tried to get past the basics. 

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020 Winner Announced

Check it out!

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 (12,013)