Question

In Breeze.js inlineCount(http://www.breezejs.com/sites/all/apidocs/classes/EntityQuery.html#method_inlineCount) implements the odata inlinecount parameter (http://www.odata.org/documentation/uri-conventions#InlinecountSystemQueryOption)

so it shows the total count after filtering but without paging.

But is there an "inline" way in either Breeze or odata to also get the full count without filtering in a single breeze query? i.e. the count of all records that would have been returned without the specified filtering. I know I could do a seperate query for this, but was hoping for a way to do it in a single operation.

Apologies if this is a silly question; I'm still getting up to speed with odata and Breeze. The reason I ask is I'm using datatables.net and it expects both the total count, filtered count and number of records so it can display something like

Showing 1 to 10 of 48 entries (filtered from 148 total entries)
Was it helpful?

Solution

I cannot come up with an easy way to do this with a single query.

If I understand your question, you want basically three counts for each query you submit

  1. The count of the query results actually returned - ( easily obtained via 'results.length' )
  2. The count of the query results that would have been returned without any skip or take ( obtained via the ".inlinecount()" method on the query.
  3. The count of the query results that would have been returned without any filter or skip or take. i.e. the count of the entire "resource". ( This one is difficult without a separate query).

If this is correct, then I think that you are stuck with performing two queries, one to get the count for the entire "resource" (i.e. #3 above) and another using the "inlinecount" method for #1 and #2

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top