keranm
keranm

Reputation: 363

Use one field to compare to another field and filter in oData

Lets say I have data like this (lots of it)

{
 "name" : "Coffee",
 "quantity": 100,
 "restock": 10
}

I want to use an odata $filter to show me ONLY items where the quantity is LESS than the restock number

Is it possible to do something like $filter=quantity lt restock I know that specific example fails. Is there a way to do this? Or do I need to fetch everything and post process it?

Upvotes: 0

Views: 1489

Answers (1)

Mark Stafford - MSFT
Mark Stafford - MSFT

Reputation: 4336

That query should absolutely be possible in most (all?) versions of OData: see http://services.odata.org/V4/OData/OData.svc/Products?$filter=Rating lt Price for a working example.

Upvotes: 2

Related Questions