Table of Contents

IT:AD:Breeze.JS:HowTo:Develop Queries/Aggregates

Summary

At present (Q1/2014), Breeze can't process Agregate commands.

Breeze does not yet support aggregate queries (count, sum, average, etc.). But we can get the count of a query without retrieving any actual data using the "take(0), inlineCount()" trick.

Process

But there workarounds:

var inlineCount, resultCount, query;
 
query = EntityQuery.from("Products")
    .where("ProductName", "startsWith", "C");
    .take(0).inlineCount();
 
em.executeQuery(query).then(function(data) {
             resultsCount = data.results.length; // 0
             inlineCount = data.inlineCount;     // count of products beginning with 'C'
        });

Resources