-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support tolower() in $orderby option #1126
Comments
Does this work if you use |
@holagathan The suggestion from @julealgon to use $compute is what I want to suggest. http://localhost/api/students?$orderby=lowername&$compute=tolower(name) as lowername More details about $compute, you can refer to this |
@xuzhg, @julealgon - Thank you for getting back. I will explore this work-around for the short term. But, are there plans to support an explicit |
Thanks @holagathan for reporting this issue. We currently don't support expressions in the Report back after trying out We'll add the issue to our backlog. We also accept pull request contribution if you're in a position to contribute. |
@gathogojr, @xuzhg - I am able to get the needed results in the first page, but the next link does not have a |
That feels like a bug to me. Can you check if there is already an issue for that, and if not, create one? |
@julealgon - No bug exists already and I have created this - #1127 - $skipToken is replaced with $skip when $compute is used. Given the both options aren't working ( |
I need support for expresions in The problem is you can't order by a string type property and have this result: |
I'm encountering the same issue as @bogdan-patraucean. Is there a work-around for this particular case? |
* Fixes #1126: enable built-in expression in $orderby * Fixes the failing test case * Add the comments * Update src/Microsoft.AspNetCore.OData/Query/Validator/OrderByQueryValidator.cs Co-authored-by: John Gathogo <[email protected]> * Apply suggestions from code review Co-authored-by: John Gathogo <[email protected]> --------- Co-authored-by: John Gathogo <[email protected]>
@xuzhg - Thank you for fixing this. I will give a try when available. |
Assemblies affected
Which assemblies and versions are known to be affected e.g. ASP.NET Core OData 8.x
Microsoft.AspNetCore.OData 8.2.3
Describe the bug
I am not able to use a
tolower(text_field_in_model)
in an$orderby
clause.Reproduce steps
Hit a request against a model that has a search string:
Data Model
EDM (CSDL) Model
Request/Response
http://localhost/api/students?$orderby=tolower(name)
Expected behavior
Results should be ordered by name (the property used in the $orderby clause)
Actual behavior
Screenshots
NA
Additional context
NA
I just checked the code and it appears only
SingleValuePropertyAccessNode
is supported, notSingleValueFunctionCallNode
.P.S.: This is a valid OData construct - https://services.odata.org/V4/TripPinService/People?$orderby=tolower(FirstName)%20desc,UserName
The text was updated successfully, but these errors were encountered: