SharePoint - What you need to know about Filtering Data

If you're building an app with a SharePoint data source, it's important to be aware of bugs and issues that can affect the filtering of data. These limitations can make it difficult to build search features or to build screens that show the data that you desire.

1 - Filtering dates with the equality operator doesn't work

If you want to show records that match a specific date, there is a bug that prevents this from working. If we use the equals (=) operator against a date field in SharePoint, PowerApps returns the error:

"The requested operation is invalid: Server Response: The expression 'fieldname eq date criteria' is not valid.


Although the equality operator doesn't work, other operators such as <, <=, >, =>  do work. But if you're thinking of combining the 'greater than' and 'less than' operators to solve this problem, you're sadly out of luck. These operators are not delegable, which means that we can't practically use these operators to search data sets with more than 2000 rows.



 Note that this is a bug that also affects SQL Server data sources.

2 - Filtering boolean (Yes/No) fields doesn't work

There is a bug that prevents us from filtering yes/no SharePoint columns. If we attempt to filter by a yes/no field, PowerApps returns no data. As the screenshot beneath shows, this query should return records but because of this bug, it returns no rows.


There's no practical workaround for this bug. To return all records where "IsVetted=true", we can get a bit further by using the criteria "IsVetted<>false" instead. However, there are two problems with this fix. First, it's not delegable (see the section beneath for more details). Second, "IsVetted<>false"  will also returns NULL records, which explains why some records with "Is Vetted" appear in the screenshot beneath. Therefore, your data source must not contain NULL data.  


For now, the best recommendation is not to use SharePoint Yes/No fields. It's better to store Yes/No data in a text field instead. Here are a couple of links with more details:


3 - Poor Delegation Support

Query delegation support with SharePoint data sources is very limited. Searches against Choice and People type fields are non deletable. As I mentioned above, the  <, <=, >, => operators are also non-delegable. Here's a screenshot of the warning that appears when we attempt to filter by a person field by email address.


As another example, here's a screenshot of the warning that appears when we try to return all records with a name that starts with "T". This is an illustration of another function that doesn't support delegation with SharePoint - the StartsWith function.


What these delegation limitations mean in practice is that if we want to carry out searches against these data types or with these operators, we won't be able to return accurate results if your SharePoint list holds more than 2000 records.

What's worse is that because the <, <=, >, =>  operators are non-delegable, we can't apply a common technique to overcome delegation problems, which is to load the source records into a local collection, and to carry out the query on the local collection. 

Conclusion

SharePoint is a very popular data source, but filtering data can be challenging due to the issues in this post. If searching and filtering data is important, you should consider storing your data in SQL Server which provides much better support for delegation.

Related posts

Data - How to remove trailing comma all rows in a table
February 20, 2025
Data - How to find the common rows from 3 or more collections
October 06, 2024
Data - How to show the distinct rows from 2 data sources or collections
February 26, 2024
Data - How to implement circular rotational date sorting
February 21, 2024
Bug - What to do when the data section of the Power Apps Maker portal doesn't work
June 18, 2023
Data - Combine columns from separate tables into a single table
October 13, 2022
Formula - Transposing/converting rows to columns- an almost impossible task?
September 23, 2021
Data - How to rename field names in a record
July 14, 2021
Data - How to hide duplicate rows in a gallery / show distinct multiple columns in a gallery
July 09, 2021
Data - Retrieving news/forum/blog articles with RSS
June 26, 2021
Data - How to sort by partial numbers in a text field
June 23, 2021
Data - How to return the last record from a table
June 19, 2021
Data - How to create bulk test/dummy records with random values
June 18, 2021
Data - 3 things you should know before using the MySQL or PostgreSQL connectors
May 11, 2021
Data - A walkthrough of how to migrate the data source of an app from Excel to Sharepoint
April 26, 2021
Data - How to enforce unique values (or prevent duplicate values) in one or more columns
April 19, 2021
Data - How much mobile data does Power Apps consume? What ways can we minimise this?
March 28, 2021
Data - How to save and retrieve Google calendar entries
March 14, 2021
Data - How to save and retrieve Google contacts
March 10, 2021
SQL - Caution! This is how users can hack shared SQL connections
January 23, 2021
SharePoint – 2 Mistakes to avoid when importing Excel data
January 10, 2021
SQL - Don't let this DateTime bug catch you out!
January 05, 2021
Settings - What's the purpose of the "Explicit Column Selection" Setting?
January 04, 2021
SQL Server for Beginners Part 3 - Installing On-Premises Gateway
January 24, 2019
SQL Server for Beginners Part 2 - Installing Management Studio
January 14, 2019
SQL Server for Beginners Part 1 - Installing SQL Server
January 04, 2019
Searching data–What you need to know about case sensitivity
December 27, 2018
Images - How to create images that can change depending on data
November 09, 2018
Excel - Reasons NOT to use Excel as a data source
September 25, 2018
Formulas - Generating Row Numbers
April 05, 2018