Skip to content
Astera Technology

Carry aggregate conditions into drilldown results

Return the exact rows supporting the displayed aggregate.

Download complete case notes and answer keys ↓

Set the decision and its input

The local report includes only nonexcluded North records. A2 and B3 produce total5. The faulty drilldown function returns all five source IDs, including excluded C and South D/E. The corrected function retains the segment and exclusion conditions when returning supporting IDs.

Filled local test worksheet
CaseInput JSON
Base test{"segment":"North","records":[{"id":"A","segment":"North","excluded":false,"units":2},{"id":"B","segment":"North","excluded":false,"units":3},{"id":"C","segment":"North","excluded":true,"units":7},{"id":"D","segment":"South","excluded":false,"units":8},{"id":"E","segment":"South","excluded":true,"units":9}]}
Download editable CSV ↓

Run the supplied comparison

The programme executes the aggregate and local drilldown function. Its returned ID list is the drilldown result contract, not evidence that a real customer interface opened those records.

Faulty and required outputs
PathOutput JSON
Faulty path{"total":5,"openedIds":["A","B","C","D","E"]}
Required path{"total":5,"openedIds":["A","B"]}
Download editable CSV ↓
Complete local Node24.14.1 programme
import assert from 'node:assert/strict';

const run=function run(i,corrected=true){
    if(i.segment===null)return {held:true};const eligible=i.records.filter(r=>r.segment===i.segment&&!r.excluded);
    return {total:eligible.reduce((s,r)=>s+r.units,0),openedIds:(corrected?eligible:i.records).map(r=>r.id)};
  };
const cases=[{"input":{"segment":"North","records":[{"id":"A","segment":"North","excluded":false,"units":2},{"id":"B","segment":"North","excluded":false,"units":3},{"id":"C","segment":"North","excluded":true,"units":7},{"id":"D","segment":"South","excluded":false,"units":8},{"id":"E","segment":"South","excluded":true,"units":9}]},"corrected":false,"expected":{"total":5,"openedIds":["A","B","C","D","E"]}},{"input":{"segment":"North","records":[{"id":"A","segment":"North","excluded":false,"units":2},{"id":"B","segment":"North","excluded":false,"units":3},{"id":"C","segment":"North","excluded":true,"units":7},{"id":"D","segment":"South","excluded":false,"units":8},{"id":"E","segment":"South","excluded":true,"units":9}]},"corrected":true,"expected":{"total":5,"openedIds":["A","B"]}},{"input":{"segment":"North","records":[{"id":"A","segment":"North","excluded":false,"units":0}]},"corrected":true,"expected":{"total":0,"openedIds":["A"]}},{"input":{"segment":null,"records":[]},"corrected":true,"expected":{"held":true}}];
for(const test of cases){const actual=await run(test.input,test.corrected);assert.deepEqual(actual,test.expected);console.log(actual);}
Download runnable example ↓

Choose from the boundary evidence

An eligible zero-valued A still belongs to the zero total’s drilldown. Missing segment is held rather than opening every row.

  1. Read aggregate conditions
  2. Reuse them for supporting rows
  3. Compare total and returned IDs

Matching a grand total does not establish row-level lineage.

Editable boundary inputs and outputs
ConditionInput JSONExpected output JSON
a legitimate zero aggregate{"segment":"North","records":[{"id":"A","segment":"North","excluded":false,"units":0}]}{"total":0,"openedIds":["A"]}
segment not defined{"segment":null,"records":[]}{"held":true}
Download editable CSV ↓

Which IDs support the base displayed total5?

Show the worked answer

A and B only. C is excluded and D/E are outside North; their presence would change the meaning of the drilldown.

Related resources