I am using the OData v2 Type-safe Client API to get a list of entities with a filter. The filter list and the entity count is quite long, so I need to use a batch request and paging. If I do not use batch then the url gets truncated, so that is a must.
I need to know the count of the whole result set.
I tried to use FluentHelperRead<>.count(), but I could not put that into the batch, as it resulted a FluentHelperCount and batch.addReadOperations() does not support that.
I also tried to .withQueryParameter("inlinecount", "allpages") in a batch, but I could not extract the resulting odata.count from the batch result.
Is there any way to do this and get a count of all result entities with batch and filtering and paging?
You are right, currently the Typed OData API of the SAP Cloud SDK does not allow to add a count operation to a batch request.
However, it is possible to do this with a workaround:
Here you are "escaping" from the typed API into the generic OData client. In there it is possible to pass on the count operation, potentially together with other operations, if you want.
In parallel we will have a deeper look into this and maybe consider this as a feature request for a future version.