Drills

A drill is a dialog of blocks that opens when the reader clicks a row of a Table or GroupedTable, or a tile. The blocks inside draw on the page's own data, with every result that has the match column cut to the clicked row's key value. So the dialog is the same report, seen for one row. A table, grouped table or kpis takes its drills in its drills prop; a tile opens one by its name.

Example

regions.sql and regionMonths.sql:

-- Sales per region
select 'North' as region, 120 as sales
union all select 'South', 95
-- Sales per region and month
select 'North' as region, '2026-01' as month, 60 as sales
union all select 'North', '2026-02', 60
union all select 'South', '2026-01', 40
union all select 'South', '2026-02', 55

In report.tsx:

import regions from "./regions.sql?raw"
import regionMonths from "./regionMonths.sql?raw"

// in defineReport({ … })
queries: {
  regions: query<{ region: string; sales: number }>(regions),
  regionMonths: query<{ region: string; month: string; sales: number }>(regionMonths),
},
blocks: (k) => [
  <k.Table
    key="regions"
    series="regions"
    title="Regions"
    columns={[{ key: "region", label: "Region", format: "text" }, { key: "sales", label: "Sales" }]}
    drills={[
      {
        name: "byRegion",
        key: "region",
        blocks: (
          <k.Line series="regionMonths" x="month" xFormat="month" y={{ sales: "Sales" }} title="Sales per month" />
        ),
      },
    ]}
  />,
],

A click on "North" opens a dialog titled "North" with a line of North's months only.

Props of a drill

NameTypeRequiredDefaultMeaning
blocksblocksyesThe blocks the dialog draws
nametextfor a tileThe name a tile's drill uses
keycolumnyes for a row drillThe clicked row's column whose value cuts the data
matchcolumnnokeyThe column the other results are cut on, when it is named differently
labelcolumnnokeyThe clicked row's column printed as the dialog's title
titletextnothe tile's labelThe dialog's title when no row names it
descriptiontextnoA line under the dialog's title

Checks

A block inside a drill naming a series or column the queries do not return fails the typecheck. A tile's drill that names no drill in drills opens nothing.