Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error when accessing OData with a number as a filter

Tags:

odata

hana

sapui5

I am trying to access an OData source provider, specifically an analytic view exposed by SAP HANA via Odata service. I'am applying a filter containing a number on odata but I am getting an error saying that using the number is not supported because of

  "Operator 'eq' incompatible with operand types 'Edm.Decimal' and 'Edm.String'

this is how I am accessing the resource:

 analyticView.xsodata/analyticView?$select=AMOUNT_SOLD,FAMILY_NAME&$filter=SALE_PRICE%20eq%20'323.7'&$format=json

I also tried to remove the quotes from the number

analyticView.xsodata/analyticView?$select=AMOUNT_SOLD,FAMILY_NAME&$filter=SALE_PRICE%20eq%20323.7&$format=json

but I am getting this error:

"Operator 'eq' incompatible with operand types 'Edm.Decimal' and 'Edm.Double'."

Could you please check what's the problem and how to resolve it.

like image 228
Mohamed Ali JAMAOUI Avatar asked Sep 18 '13 15:09

Mohamed Ali JAMAOUI


People also ask

How do I filter OData query?

You can use filter expressions in OData requests to filter and return only those results that match the expressions specified. You do this by adding the $filter system query option to the end of the OData request.

What are some of the things that an OData service contains?

A URL used by an OData service has at most three significant parts: the service root URL, resource path and query options.


1 Answers

You can try adding an M to the end of the number you are filtering on.

$filter=SALE_PRICE%20eq%20323.7M

See here for more information

like image 52
qujck Avatar answered Sep 21 '22 15:09

qujck