How can I get the count of filtered OData results?

Viewed 491

I am attempting to get the count of filtered OData results in a Fiori SAPUI5 application. I am able to get the correct count using both $count and $inlinecount in Postman using the following: MyEntitySet/$count?$filter=Id eq '9' and MyEntitySet?$filter=Id eq '9'&$inlinecount=allpages&$format=json.

However, when I try to use these query parameters in my UI5 code, I don't get the result I want.

myV2ODataModel.read("/MyEntitySet/$count?$filter=Id eq '9'", {/*...*/});

gives me the count of the unfiltered results, while

myV2ODataModel.read("/MyEntitySet?$filter=Id eq '9'&$inlinecount=allpages", {/*...*/});

gives me all the records, and I am unable to access the inline count.

1 Answers
Related