MCPcopy Create free account
hub / github.com/microsoft/SandDance / countsRef

Function countsRef

docs/app/js/sanddance-app.js:148260–148284  ·  view source on GitHub ↗
(scope, field6, sort)

Source from the content-addressed store, hash-verified

148258}
148259DataScope.prototype = {
148260 countsRef (scope, field6, sort) {
148261 const ds = this, cache2 = ds.counts || (ds.counts = {}), k = fieldKey(field6);
148262 let v, a, p;
148263 if (k != null) {
148264 scope = ds.scope;
148265 v = cache2[k];
148266 }
148267 if (!v) {
148268 p = {
148269 groupby: scope.fieldRef(field6, "key"),
148270 pulse: ref(ds.output)
148271 };
148272 if (sort && sort.field) addSortField(scope, p, sort);
148273 a = scope.add(Aggregate(p));
148274 v = scope.add(Collect({
148275 pulse: ref(a)
148276 }));
148277 v = {
148278 agg: a,
148279 ref: ref(v)
148280 };
148281 if (k != null) cache2[k] = v;
148282 } else if (sort && sort.field) addSortField(scope, v.agg.params, sort);
148283 return v.ref;
148284 },
148285 tuplesRef () {
148286 return ref(this.values);
148287 },

Callers

nothing calls this directly

Calls 6

fieldKeyFunction · 0.70
refFunction · 0.70
addSortFieldFunction · 0.70
AggregateFunction · 0.70
CollectFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected