3

My returning Object from back end is IQueryable<Article> and Article has a collection of tags which is IEnumerable<string>

for example

[
  {
    id: 'Article 1'
    tags : [{'t1','t2','t3'}]
  },
  {
    id: 'Article 2'
    tags : [{'t5','t6','t1'}]
  },
]

I can filter records by Odata query as below

http://localhost:52475/api/articles?$select=id,tags&$filter=tags/any(item: substringof('j',item) eq true) 

Now I want to sort this by $orderBy I tried below but no chance

http://localhost:52475/api/articles?$select=id,tags&$orderby=tags(item: item)

http://localhost:52475/api/articles?$select=id,tags&$orderby=tags

http://localhost:52475/api/articles?$select=id,tags&$orderby=tags/

http://localhost:52475/api/articles?$select=id,tags&$orderby=tags(item)

I know that if tags collection has another property called name I could use this

http://localhost:52475/api/articles?$select=id,tags&$orderby=tags/name

But it doesn't have , and also I am not able to change backend

Reza
  • 18,865
  • 13
  • 88
  • 163
  • I have the same issue. And this question is the same as [this one](https://stackoverflow.com/questions/43548165/in-odata-is-there-a-way-to-order-by-the-first-element-in-an-array). Any help? – Pedro Calero Nov 08 '19 at 08:45
  • Unfortunately I couldn't find a solution for it – Reza Nov 09 '19 at 17:34

0 Answers0