slicetree

slicetree, tile type

The slicetree tile provides a hierarchical slice selector.

Example

table P = with
  [| as Family, as Subfamily, as Product, as Price |]
  [| "Garment", "Clothing", "Pant", 25 |]
  [| "Garment", "Clothing", "Shirt", 15 |]
  [| "Garment", "Accessory", "Hat", 12 |]
  [| "Home", "Furniture", "Table", 75 |]

table Slices[slice] = slice by P.Product title: P.Product

Slices.Family = same(P.Family)
Slices.Subfamily = same(P.Subfamily)
Slices.Product = same(P.Product)

show slicetree "Product tree" with
  Slices.Family
  Slices.Subfamily
  Slices.Product

show table "Selected product" slices: slice with
  P.Product
  P.Price

When the tree selection is “Garment > Clothing > Pant”, the table shows:

Product Price
Pant 25

Remarks

Each expression passed to show slicetree defines one hierarchy level. The order of those expressions defines the hierarchy from top to bottom.

The tile is evaluated on the Slices table created by slice by. Each level must resolve to one text value per slice. Use vectors already stored in Slices, or expressions such as same(P.Family) that produce one value per slice. Raw source-table vectors such as P.Family cannot be used directly.

Selecting an entry updates the current slice selection. Only tiles declared with a slices: option are recomputed for that selection. Tiles without slices: remain global.

The order by tile option can sort the rows, but it does not define the hierarchy. After sorting, each subtree must still remain contiguous. In other words, once a parent value has been left behind, it cannot reappear later in the sequence. For a hierarchy built from Slices.Department, Slices.Category, and Slices.Item, an ordering such as order by [Slices.Department, Slices.Category, Slices.Item] is valid, while an ordering driven only by Slices.Item may fail because it can interleave items from different parent groups. This constraint is checked when the dashboard is produced, so a compile-only validation can succeed while the run fails on an invalid show slicetree. The group by clause is not supported.

StyleCode can be attached to the tile and to each hierarchy level. For generic StyleCode rules, see stylecode. For the supported attachment points, see slicetree tile and entry. The property selectAllLabel enables an “All” choice for a hierarchy level.

User Contributed Notes
0 notes + add a note