Forum Discussion
How to use operators in URL filters?
Hi!
I'm trying to use the Contains filter operator in my modern SharePoint list, and it's ignoring that parameter. I've tried using a greater-than operator with a numeric field, and it also ignores that.
I want it to return all results that contain "pend" in the status column.
How should I use it?
I can't use the view configuration because the filtering is meant to be dynamic. The user, using an SPFx ListViewCommandSet extension, has a button that allows them to filter with operators.
We're really stuck on this.
Thanks!
3 Replies
- FjDevCorCopper Contributor
Does anyone have any idea how I can use operators in these sharepoint list URLs?
https://weblogs.asp.net/ricardoperes/filtering-and-sorting-sharepoint-list-views - FjDevCorCopper Contributor
Hello and thanks for responding!
The examples you provided are for using the API, and for now, all I want is:
- When I access a SharePoint list, filter the data by URL using the FilterOp1 parameter.
This article is quite old, but it's exactly what I want to do.
https://weblogs.asp.net/ricardoperes/filtering-and-sorting-sharepoint-list-views
- JoyceBeattyIron Contributor
1. Practical application examples
Multi-criteria filtering
url
https://yourdomain.sharepoint.com/_api/web/lists/getbytitle('items')/items?
$filter=Status eq 'In Progress' and DueDate lt datetime '2023-12-31T23:59:59'
2: Fuzzy Matching
url
https://yourdomain.sharepoint.com/_api/web/lists/getbytitle('document')/items?
$filter=substringof('Budget',Title)
3: date range query
url
https://yourdomain.sharepoint.com/_api/web/lists/getbytitle('Meeting')/items?
$filter=EventDate ge datetime'2023-11-01T00:00:00' and EventDate le datetime'2023-11-30T23:59:59'
4. Special Tips
Nested queries:
url
$filter=Department/Title eq 'Finance Department' &$expand=Department
5. Null value checking:
url
$filter=Description ne null
6. sort combination:
url
$filter=Status eq 'Active' &$orderby=Created desc