Dashboards, slicing

Slicing defines multiple dashboard variants and lets the user pick which one is shown. This page focuses on the language mechanics behind slices and how they affect tiles.

Table of contents

Slices are defined once per script

Slicing starts by creating a dedicated Slices table with slice by. The table is upstream of the data it slices, and the definition can appear only once in a script. The title: option sets the name shown in the slice selector.

table Products[pid] = with
  [| as pid, as Name, as Price |]
  [| "P-01", "Widget", 12.0 |]
  [| "P-02", "Gizmo", 18.0 |]

table Slices[slice] = slice by pid title: Products.Name

show table "Selected product" slices: slice with
  Products.Name
  Products.Price { unit: "$" }

show scalar "All products" with count(Products.*)

The slices: option recomputes tiles

Tiles with slices: are recomputed for the active slice. Tiles without it are global and show the same content regardless of selection. The slice vector must belong to the tile’s data table or be broadcast to it. See slices for the full rules.

Slice selectors are tiles too

The selector UI is part of the dashboard. Use slicepicker for a drop-down or slicetree for a hierarchy. These tiles make the slice context visible next to the data it controls.

table Products[pid] = with
  [| as pid, as Category, as Name, as Price |]
  [| "P-01", "Hardware", "Widget", 12.0 |]
  [| "P-02", "Hardware", "Gizmo", 18.0 |]
  [| "P-03", "Accessories", "Case", 6.0 |]
  [| "P-04", "Accessories", "Cable", 4.0 |]

table Slices[slice] = slice by pid title: Products.Name subtitle: Products.Category

show slicetree "Products" with
  slice

show table "Selected product" slices: slice with
  Products.Name
  Products.Category
  Products.Price { unit: "$" }

See also

User Contributed Notes
0 notes + add a note