api-guidelines icon indicating copy to clipboard operation
api-guidelines copied to clipboard

Filters: "in" operator

Open trshiv opened this issue 7 years ago • 0 comments

Frequently, there are filter expressions where the same attribute is compared with multiple values like -

$filter=categoryId eq 'cat1000' or categoryId eq 'cat1001' or categoryId eq 'cat1002'

It is very desirable to write the above as

$filter=categoryId in ['cat1000', 'cat1001', 'cat1002']

This is less verbose and much better for human readability and visual debugging, especially when combining multiple such filter conditions. Eg. $filter=categoryId in ['cat1000', 'cat1001', 'cat1002'] and productId not in ['201', '210'].

trshiv avatar Dec 18 '18 11:12 trshiv