Reputation: 11448
I am trying to create a Predicate
using a decimal data type but I get the following error:
Error retrieving data.A binary operator with incompatible types was detected.
Found operand types 'Edm.Decimal' and 'Edm.Double' for operator kind 'Equal'.
Error: A binary operator with incompatible types was detected. Found operand types
'Edm.Decimal' and 'Edm.Double' for operator kind 'Equal'.
Here is the code I am trying it with:
// engineSize equals 1.4 in this case.
predicate.create('engineLitreCapacity', '==', engineSize);
Upvotes: 1
Views: 658
Reputation: 21
I'had the same issue. I found the mistery :)... I think that's somethings in naming convention related to metadata and the REST service controller sign: Eg:
Doesn't work
/*Breeze Controller Server Side*/
[HttpGet]
public IQueryable<Product> Items()
{
return _contextProvider.Context.Products;
}
/*Client*/
query = breeze.EntityQuery
.from("Items")
.where(Predicate.create('BasePrice', >', 1)
.orderBy(sortString)
.select(selectData)
.skip(skip)
.take(take)
.inlineCount();
It' works !!
/*Breeze Controller Server Side*/
[HttpGet]
public IQueryable<Product> Products()
{
return _contextProvider.Context.Products;
}
/*Client*/
query = breeze.EntityQuery
.from("Products")
.where(Predicate.create('BasePrice', >', 1)
.orderBy(sortString)
.select(selectData)
.skip(skip)
.take(take)
.inlineCount();
Upvotes: 2
Reputation: 17052
What is the datatype in metadata for the 'engineLitreCapacity' and does it match the datatype on your database for the same field? If not, how was your metadata initialized, via a FetchMetadata call or was it created by hand?
Upvotes: 1
Reputation: 718
You need to parseFloat
the engineSize
:
predicate.create('engineLitreCapacity', '==', parseFloat(engineSize));
Upvotes: 1