How do I explore, group and chart results?

Prev Next

The transcript shows a summary of each result, but LumiCode can take you much further without writing another query: browse every row, group the rows with exact totals, see the spread of each numeric column, or draw a chart straight into the transcript. Each of these works on the whole result, however large, not just the rows on screen.

Prerequisites

For the examples here we will use:

select [TableName] ,[FieldName] ,[FieldType] ,[DataType] ,[IsPrimaryKey] 
from Sys.Field
where TableName in ('Sys.File', 'Sys.Connection', 'Sys.Field', 'Sys.Registration')
select [TableName], [FieldType], [DataType], Count(*) 
from Sys.Field
where TableName in ('Sys.File', 'Sys.Connection', 'Sys.Field', 'Sys.Registration')
group by 1, 2, 3

Methods

Method 1: Browse every row with /rows

Type /rows and press Enter. LumiCode opens a grid of the last result.

Key

What it does

Arrow keys

Move between rows, and move the column cursor (▸ in a heading)

Enter

Open the current row in full, one field per line

s

Sort by the column under the cursor

Shift+s

Add the column to the sort, after any already sorted. Press again to reverse it, and again to remove it.

c

Choose which columns are shown

/

Filter the rows with SQL, for example strftime('%Y-%m', SomeDate) = '2026-06'

Esc

Clear the filter, then leave

In a row opened in full, press [ and ] to move to the previous or next row, and c to copy the marked field's value. Press Enter on a field to read a long value in full.

Method 2: Group the rows with /group

  1. Type /group and press Enter.

  2. Choose the column to group by. LumiCode offers the likeliest answer first, so you can press Enter to accept it. Add more levels to nest groups inside groups.

  3. Choose the figures to show for each group. Every group shows #, its number of rows. A numeric column can also show sum, avg, min, max, median and a count of distinct values. A date column can show min and max.

LumiCode shows one line per group. Press Enter to open or close a group. The totals are worked out on the server over every row in the group, so they are exact.

A date level can be grouped by year, year and month, week or hour. To show months inside years, use the same date column twice.

Repeat a grouping

Name the columns to skip the questions, for example /group TableName DateType max:IsPrimaryKey.

A plain column name is a level, sum:SomeValue is a figure, and SomeDate:year groups a date by year. The Up arrow then repeats the whole grouping.

Method 3: Summarise numeric columns with /stats

Type /stats and press Enter. For every numeric column, LumiCode shows the minimum, median, maximum and average, with a sparkline of the values. The figures cover every row.  This requires at least one numeric field in the result.

Method 4: Draw a chart with /chart

  1. Type /chart and press Enter.

  2. Choose the kind of chart.

  3. Choose the column to group by and the column to measure. LumiCode offers the likeliest answer first each time, and Esc steps back a question.

LumiCode draws the chart into the transcript, beside the query. The line above the chart says what it shows and anything it left out.

To show

Use

A total per category

column (vertical, for a sequence) or bar (horizontal, for a ranking)

What each total is made of

stacked

Two categories side by side

grouped

Shares of a total

pie or treemap

The spread of values in each category

boxplot

A measure per day

calendar

A running total built up step by step

waterfall

The gap between two measures

dumbbell

How values are distributed

histogram

Two categories crossed

heatmap

One value against another, or over time

line, scatter or multiline

To see an example of every kind, type /chart gallery. No query is needed.

To skip the questions, name the kind and the columns, for example /chart bar ResourceType Requests. A column whose name contains a space has to be chosen from the questions instead.

Troubleshooting

Lines and scatter plots show blanks or boxes

Line and scatter charts use braille dots, which some terminals and fonts can't draw. Run /set chart-dots blocks to use blocks instead.

A chart loses its colours in a saved transcript

Markdown can't hold colours. Use /transcript html to save a session with charts in it.