Record counts are returned in two dgraph properties.
To retrieve the counts for regular (non-aggregated) or aggregated records beneath a given refinement (dimension value), use these dgraph properties:
Counts for regular (non-aggregated) records on refinements are returned as a property on each dimension value. For regular records, this property is
DGraph.Bins
.Counts for aggregated records are also returned as a property on each dimension value. For aggregated records, this property is
DGraph.AggrBins
.
For a given
Navigation
object, request all refinements within each
dimension with:
The refinements are returned in a
DimValList
object.
For each refinement, the dimension value (DimVal
object) that is a refinement beneath the dimension can be returned with:
To get a list of properties (PropertyMap object) associated with the dimension value, use:
Calling the
PropertyMap.get()
method (Java) or
PropertyMap
object (.NET) at this point, with the
DGraph.Bins
or
DGraph.AggrBins
argument will return a list of values
associated with that property. This list should contain a single element, which
is the count of non-aggregated or aggregated records beneath the given
dimension value.
The following code samples show how to retrieve the number of records
beneath a given dimension value. The examples retrieve the number of regular
(non-aggregated) records, because they use the
DGraph.Bins
argument for the calls. To retrieve the
number of aggregated records, use the same code, but instead use the
DGraph.AggrBins
argument.
Example 45. Java example of getting the record counts beneath a refinement
DimValList dvl = dimension.getRefinements(); for (int i=0; i < dvl.size(); i++) { DimVal ref = dvl.getDimValue(i); PropertyMap pmap = ref.getProperties(); // Get dynamic stats String dstats = ""; if (pmap.get("DGraph.Bins") != null) { dstats = " ("+pmap.get("DGraph.Bins")+")"; } }
Example 46. .NET example of getting the record counts beneath a refinement
DimValList dvl = dimension.Refinements; for (int i=0; i < dvl.Count; i++) { DimVal ref = dvl[i]; PropertyMap pmap = ref.Properties; // Get dynamic stats String dstats = ""; if (pmap["DGraph.Bins"] != null) { dstats = " ("+pmap["DGraph.Bins"]+")"; } }