I have this JayData query (it can be checked at JSLQ playground):
northwind.Products
.filter( function( product ) {
return product.ProductName.toLowerCase() in ['tofu'];
} )
.toArray( function( products ) {
console.dir( products );
} );
For some unknown reasons this query produces incorrect filter expression: http://services.odata.org/Northwind/Northwind.svc/Products?$filter=(tolowerProductName%20eq%20%27tofu%27)&$callback=parent.handleJSONP_21&$format=json
I highlighted incorrect parameter with bold above.
So you can see that we have tolowerProductName, but it should be tolower(ProductName), so the right filter query should looks like this: http://services.odata.org/Northwind/Northwind.svc/Products?$filter=%28tolower%28ProductName%29%20eq%20%27tofu%27%29&$callback=parent.handleJSONP_21&$format=json
Is anybody know a workaround?
Update: Issue occurs only when I use toLowerCase with "in [array]", so for example this query is working just fine:
northwind.Products
.filter( function( product ) {
return product.ProductName in ['Tofu'];
} )
.toArray( function( products ) {
console.dir( products );
} );
This query with toLowerCase is working just fine too:
northwind.Products
.filter( function( product ) {
return product.ProductName.toLowerCase() == 'Tofu';
} )
.toArray( function( products ) {
console.dir( products );
} );
Thank you!