Querying Accounting Data

Overview


Sales Person Hierarchy


The sales consists of a group of employees. There is a single manager for the team, Jane. Some members of the team report directly to her. Gwen reports to Jane, but underneath her, there are other salepeople that report to her.



The data can be represented as an array of objects.


let salesteam = [
{ name: 'jane'}, {name:'joe', manager:'jane'}, {name:'gwen', manager:'jane'},
{name:'jim', manager:'jane'}, {name:'john', manager:'jane'}, {name:'johnson', manager:'jane'},
{name:'gary', manager:'gwen'},{name:'michelle', manager:'gwen'}
]
					

Tree Hierarchy


The sales hierarchy present above is structured as an array of objects. The data can be converted to a more convenient tree structure using the tree-map library.


const $tree = await import("/lib/tree/v1.0.0/tree-map.mjs");

let treemap = $tree.fromTable(salesteam);
					
Try it!

Contents