angularjs - How to filter the the odata query with case insensitivity when already using a function? -
i have complex odata query passing through angular using odataangularresrouce library. know odata queries case sensitive , dont know how data being stored in database. here predicates used build query.
var predicfirstname = new $odata.predicate(new $odata.func("startswith", "firstname", new $odata.func("tolower", $scope.searchobject.searchstring)), true); var prediclastname = new $odata.predicate(new $odata.func("startswith", "lastname", new $odata.func("tolower", $scope.searchobject.searchstring))); **odata uri:** https://localhost/app/tyleridentityuseradministrationservice/users/$count/?$filter=((startswith(firstname,tolower(fahad)))%20or%20startswith(lastname,tolower(fahad)))
as can see, want put function check given string startswith. have seen several posts solution put tolower(). however, when put way mentioned above not returning data. can here?
thanks -fahad
both properties , literal strings in $filter
need converted lowercase. , since literal strings originate on client, can optimize converting them lowercase before send odata request.
$filter=startswith(tolower(firstname),'fahad') or startswith(tolower(lastname),'fahad')
note literal strings must surrounded single quotes in filter expression.
Comments
Post a Comment