Skip to Content
Jul 06, 2020 at 09:20 PM

How can I implement $count=true support with an external OData v2 service in CAP?


Running the Fiori preview on an entity which is being served from an external OData v2 service the page shows the error 'Feature not supported: Method .count of fluent API'. Is there a way this can be resolved in the service implementation?

This would support $filter in the query (and therefore is not the solution I'm after), but for testing purposes I tried checking for req.query.cqn.count being true and then executing an explicit OData v2 $count request:

return await ext.tx(req).get("/User/$count")

This does get the count, but returning a number in the service implementation then results in the following error:

[2020-07-06T19:41:42.970Z | ERROR | 1773773]: An error occurred during serialization of the entity collection.