slices
Slices, built-in table
The Slices table is created when a dashboard is sliced. When slicing is
enabled:
- One slice is visible at a time.
- A selector appears in the dashboard header.
- Tiles with the
slices:option are recomputed per slice. - StyleCode
#(...)can use vectors inSlicesto vary styling per slice.
Example
table T[t] = with
[| as Product, as Color |]
[| "Pants", "Blue" |]
[| "Cap", "Red" |]
[| "T-shirt", "White" |]
table Slices[slice] = slice by t title: T.Product subtitle: T.Color
{ tileColor: #(same(T.Color) into Slices) }
show table "Contents of slice" slices: slice with
T.Product
T.Color
When the slice “Pants” is selected, the tile shows:
| Product | Color |
|---|---|
| Pants | Blue |
Slicing tiles
Most tiles can be sliced by adding a slices: option that points to a slice vector of the tile’s data table.
show table "Orders" slices: Items.Slice with
Orders.Date
Orders.Client
Orders.Quantity
order by Orders.Date
When slicing a linechart, the grouping must be explicit:
show linechart "Weekly Quantity Sold" slices: WeekItems.Slice with
sum(WeekItems.QtySold) as "Qty Sold"
group by WeekItems.monday
Syntax
table Slices[slice] = slice by [tuple] title: Expr subtitle: Expr
All vectors are expected to be in the same source table, which receives slice
as a secondary dimension.
Remarks
The by tuple controls the number and order of slices.
title is mandatory and must be unique per tuple value.
subtitle is optional and can include up to 255 values per tuple.
The number of slices is limited to 200,000.
The Slices table can be created at most once per script.