Reputation: 212
Currently, my query string is like below,
http://localhost:49442/Orders/?$count=true&$filter=not%20(Freight%20eq%202.3)%20and%20(startswith(tolower(CustomerID),%27b%27))&$skip=0&$top=12
But here not-operator only worked to filter the Freight column. But I want to commonly us this not-operator to filter Freight and CustomerID.
Upvotes: 2
Views: 454
Reputation: 16767
Its hard to identify your intended expression as it is half-way between two:
If you want to exclude only the rows where both of the following are true at the same time:
Then you can do this by rearranging the brackets, the following is the same as saying:
"Exclude orders where the Customer starts with b, but only if the freight is 2.3"
http://localhost:49442/Orders/?$count=true&$filter=not(Freight eq 2.3 and startswith(tolower(CustomerID),'b'))&$skip=0&$top=12
If instead you want to exclude all orders that have customers that start with 'b' AND also exclude all other orders where the freight is 2.3 then you must specify not twice in your query
This is the same as: "Exclude orders where the Customer starts with b, or if the freight is 2.3"
http://localhost:49442/Orders/?$count=true&$filter=not(Freight eq 2.3) and not(startswith(tolower(CustomerID),'b'))&$skip=0&$top=12
Upvotes: 0