Skip to main content

Function: reportDataFromTotals()

reportDataFromTotals(spec, groups): ReportData

Defined in: packages/core/src/report/totals.ts:163

Stored group totals as ReportData: exactly what summarizeReport(rows, spec) gives for the rows the totals counted, when each group holds what the summarizer's fold would hold for its rows. Group order does not matter. With no dimensions and no groups the result is one group of zeros, as for no rows.

Throws ReportValidationError for an invalid spec, and for a group that:

  • is not an object, or does not have one cell per dimension and one object per measure;
  • has a cell that is not a [value, kind] pair whose value fits its kind;
  • has a count (rows, used, missing, invalid, distinct) that is not a non-negative safe integer, or a sum, min or max that is neither a number nor null;
  • has a measure with a path whose used + missing + invalid is not the group's rows, or whose distinct is above its used;
  • has the same cells as another group.

Issue paths start at the group's index. The stored values are not checked against each other beyond this: a min above its max, or a distinct of 0 when used is not, finishes as stored.

Parameters​

spec​

ReportSpec

groups​

Iterable<ReportTotalsGroup>

Returns​

ReportData